Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9223407
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T04:04:22+00:00 2026-06-18T04:04:22+00:00

I am loading a Modal popup form using PartialView The code $(#modalContainer).load(‘@Url.Action(NewRefill,Car,new {car=@Model.Id})’); $.validator.unobtrusive.parse($(#modalContainer

  • 0

I am loading a Modal popup form using PartialView

The code

 $("#modalContainer").load('@Url.Action("NewRefill","Car",new {car=@Model.Id})');

                        $.validator.unobtrusive.parse($("#modalContainer form"));

                        $("#addNewEntryModal").modal('show');

in my Controller I have

[HttpPost]
        public ActionResult NewRefill(Car car,int car)
        {
            if (ModelState.IsValid)
            {


            }
            return Json(new { Success = false });

        }

This is a Modal popup. Every time You hit submit, it automatically forwards you to a new page. What I would like it to do would be to Keep the Modal open and show the Errors that happen. I have tried binding to the Submit event and stopping it to no avail. The validations do work since I see the Red borders but I get forwarded and see the Success=false

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T04:04:23+00:00Added an answer on June 18, 2026 at 4:04 am

    You are not parsing the jQuery unobtrusive validations at the right place. You should do that once you load the partial, inside the success callback:

    var url = '@Url.Action("NewRefill", "Car", new {car = @Model.Id})';
    $('#modalContainer').load(url, function() {
        $.validator.unobtrusive.parse($("#modalContainer form"));
        $("#addNewEntryModal").modal('show');
    });
    

    Also if inside this partial you are using an Ajax.BeginForm helper to generate the form make sure that you have included the jQuery.unobtrusive-ajax.js script to your page for this to work. And if it is a normal Html.BeginForm you should AJAXify it if you want it to be submitted with an AJAX request instead of a normal request:

    var url = '@Url.Action("NewRefill", "Car", new {car = @Model.Id})';
    $('#modalContainer').load(url, function() {
        var form = $("#modalContainer form");
        $.validator.unobtrusive.parse();
        $("#addNewEntryModal").modal('show');
        form.submit(function() {
            $.ajax({
                url: this.action,
                type: this.method,
                data: $(this).serialize(),
                success: function(result) {
                    ...
                }
            });
            return false;
        });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am loading a partial view in the popup using following code: <div id=Mydiv
I am using jquery ajax to load a separate page into a modal window
Basically I want a modal windows popup with loading indicator when a user first
I've created a modal popup using jQuery (while following this tutorial). It works well,
I am actually loading a page as a modal dialog box as window.showModalDialog(url.aspx). The
I'm experiencing issues with twitter's bootstrap-modal javascript. I'm just using the same code they
When loading the class, using method forName() , any static initializers in the class
The file I'm loading into the modal dialog can vary in height. When the
I'm looking for a jQuery image modal box plugin which show loading icon inside
I'm using the colorbox plugin for modal popups. It's working nicely, but there's a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.