Error in jquery.validate.js in MVC 4 project with jQuery 1.9

I created a new ASP.Net MVC 4 project using a template in Visual Studio 2012. After upgrading to jQuery 1.9, the login function breaks. In particular, I get an error

0x800a138f - JavaScript Runtime Error: Unable to get undefined property call or null reference

at row 1172, column 5 in jquery.validate.js

How can I fix this problem?

+59
jquery jquery-validate unobtrusive-validation
Feb 02
source share
7 answers

This issue is fixed in the jQuery 1.11.0pre validation plugin.

Unfortunately, there is currently no pre-release version on NuGet, so currently you need to download jquery.validation.js directly from GitHub:

jQuery.Validation 1.11 is now available through NuGet (thanks @Simon_Weaver).

UPDATE

It seems that general support for jQuery 1.9 is in the jQuery.Validation database, but not yet released

https://github.com/jzaefferer/jquery-validation/pull/613

+83
Feb 02
source share

If you install jQuery.Migrate 1.1.1, then it works fine with jQuery.Validation 1.11, jQuery 1.9 and 2.x.

As with the install-package jQuery.Migrate , you must add JavaScript to BundleConfig.cs - I added it right after jQuery, and this is what the line that jQuery registers now looks like:

 bundles.Add(new ScriptBundle("~/bundles/jquery").Include( "~/Scripts/jquery-{version}.js", // jQuery itself "~/Scripts/jquery-migrate-{version}.js")); // jQuery migrate 
+37
Aug 6 '13 at 6:05
source share

The problem is the line of code inside the validation script

 $.event.handle.call(this,e); 

The problem here is $.event.handle . Both this and e have the correct meaning. jQuery has deprecated $ .event.handle in favor of jQuery.event.dispatch according to the migration script http://code.jquery.com/jquery-migrate-1.2.0.js .

Correcting these errors is as simple as simply replacing the descriptor link with the submit.

This can be wrapped in a document.ready callback to ensure that it runs after other scripts are run.

 $(function(){ jQuery.event.handle = jQuery.event.dispatch }); 
+10
Jul 09 '15 at 20:01
source share

I had the same problem, not a problem in firefox, but I still threw an error. I am using jquery-2.0.0; JQuery Validation Plugin 1.11.1

I found a fix: replace

 @section Scripts { @Scripts.Render("~/bundles/jqueryval") } 

from

 @section Scripts{ <script src="@System.Web.Optimization.BundleTable.Bundles.ResolveBundleUrl("~/bundles/jqueryval")"></script> } 
+8
May 20 '13 at
source share

Replacing a bunch of scripts with the following line for me.

  <script src="@System.Web.Optimization.BundleTable.Bundles.ResolveBundleUrl("~/bundles/jqueryval")"></script> 

I tried updating jquery validation through Nuget and also upgraded the jquery version to version 2.0, but none of these solutions worked. The only one that worked perfectly without loading anything. The preview was the solution proposed by Texellab

+2
Sep 09 '13 at 13:07 on
source share

The main problem is that some methods that are deprecated since jQuery 1.7 (when new, improved methods were added) were removed in 1.9. jQuery Validate did not seem to be updated, so it uses new methods instead. I found that using the jQuery Migrate plugin, which returns remote methods, solved my problems with this.

0
May 31 '13 at 20:36
source share

Here's another solution:

I used MVC 3 with jQuery 1.71 and jQuery UI 1.8.20. I used the jQuery UI Tabs widget and set up each tabbed area to load a partial page containing input fields.

Works great in Firefox v22 and Chrome v28, doesn't work in IE10. The error I received is "Unable to get property settings" undefined or null reference

The solution was to go to partial forms and comment on the following code:

 <script src="@Url.Content("~/Scripts/jquery-1.7.1.min.js")" type="text/javascript"></script> <script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script> <script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>* 

Now it works successfully in all browsers.

0
Jul 19 '13 at 8:45
source share



All Articles