Please support jQuery v1.9.0 properly in jquery.validate.unobtrusive - by MagnusJay

Status : 


Sign in
to vote
ID 776965 Comments
Status Active Workarounds
Type Bug Repros 18
Opened 1/19/2013 4:36:41 AM
Access Restriction Public



since upgrading to jQuery v1.9, and using the latest jquery.validate.unobtrusive (Microsoft.jQuery.Unobtrusive.Validation" version="2.0.20710.0")

  my code crashes with 
Line: 524
Error: Invalid character
in jQuery.

The reason seems to be that jquery.validate.unobtrusive is calling jQuerys parseJSON with an undefined value. This was accepted in earlier version of jQuery, but v1.9+ does correctly now throw an error.

Also see:
Sign in to post a comment.
Posted by Shimmy Weitzhandler on 3/16/2015 at 2:57 AM
Still experiencing the issue.
I'm using DataAnnotations' [Range(typeof(DateTime), "01/01/1915", "01/01/2035")], which wouldn't let the validation pass under any condition.

Here's the rendered element:

<input class="form-control text-box single-line input-validation-error" data-val="true" data-val-date="The field BirthDate must be a date." data-val-range="The field BirthDate must be between 01/01/1915 12:00:00 AM and 01/01/2035 12:00:00 AM." data-val-range-max="01/01/2035 00:00:00" data-val-range-min="01/01/1915 00:00:00" data-val-required="The BirthDate field is required." id="BirthDate" name="BirthDate" type="date" value="" aria-required="true" aria-invalid="true" aria-describedby="BirthDate-error">

See my comment here:
Posted by Rob_ICS on 5/7/2013 at 4:33 AM
This is not fixed in the latest version.
Posted by marianotigre on 5/3/2013 at 7:42 AM
Is this bug fixed?
Posted by Andreas Larsen on 3/29/2013 at 12:42 PM
To be clear, before clearing the browser cache I also ran a Build Clean, and in my best superstition also deleted all bin and obj folders before rebuilding in the hopes to delete any server side caching of the javascript bundling.
It did not have any effect on its own, so I then force refreshed the browser, and that's when it fixed the problem for me.
It is possible that a combination of cleaning both server side and client side cache was necessary. I'm not sure.

There is a SO post here:
Posted by Andreas Larsen on 3/29/2013 at 12:24 PM
After digging some more, it seemed it was the cache of my browser that did not pick up the changes. I force refreshed the page and the validation errors no longer occur.
Posted by Andreas Larsen on 3/29/2013 at 12:11 PM
Same here. The error still applies to 2.0.30116.0.
Posted by Jorin Slaybaugh on 3/25/2013 at 9:40 AM
I'm with @chuck02323. I've just installed 2.0.30116.0 via nuget and am still getting "Uncaught type error: unexpected token: u". When I add in jQuery.Migrate 1.1.1 it works, but lets me know that "jQuery.parseJSON requires a valid JSON string" so it is clearly still choking on undefined.

Also, might I suggest that in the comment header at the top of jquery.validate.unobtrusive.js (or any other plugin for that matter) you guys put the version number so we can be sure what version is actually there?? As it is now, the only way we have any idea of the version number is from nuget, so if the package is busted somehow and adding in old files, there's no way to know for sure.
Posted by stmarti1 on 3/18/2013 at 6:56 AM
The range validator is completely broken. Please fix it.
Posted by StijnHerreman on 3/15/2013 at 3:48 AM
chuck02323, are you talking about the undefined JSON issue, or a different issue?
We've verified that with 2.0.30116.0 the issue no longer occurs, normal and minified libraries. Switching back to the previous version immediately reintroduces the issue, so I think it's safe to say that at least something was fixed.
Posted by chuck02323 on 3/7/2013 at 6:29 AM
Not fixed as of 3/4/13 or at least it's not fixed in 2.0.30116.0 published 2/18/13
Posted by Microsoft on 2/27/2013 at 2:02 PM
Thank you for reporting this issue. The issue has been fixed in our latest release. Please do keep the feedback flowing.

ASP .Net Team
Posted by Lajos Marton on 2/9/2013 at 2:42 PM
There is another bug in the unobtrusive js.
For example ASP.NET MVC Range validation doesn't work anymore.
adapters.AddMinMax should be like this:
var min = Number(options.params.min),
     max = Number(options.params.max);

I think there will be more errors, if somebody would check all of adapters. Please fix unobtrusive.js ASAP.
Posted by Code Chief on 1/30/2013 at 7:59 AM
Also the "cancel" class is broken, added a workaround for that I found from somebody else.

Please raise the priority of this issue so it will be fixed soon!!!
Posted by Code Chief on 1/30/2013 at 3:52 AM
Please include the update of jquery.unobtrusive-ajax.js when you add support for jQuery 1.9. I am not getting post backs in the right place, it is replacing the whole page not the target ID which worked before.

Because people are using NuGet Package Manager more with Visual Studio 2012 I'd say this is a pretty critical issue (we are prompted to update when we start VS 2012). If you can produce a hotfix soon rather than a long rewrite please do that ASAP!
Posted by Microsoft on 1/20/2013 at 10:01 PM
Thanks for your feedback.

We are rerouting this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.
Posted by Microsoft on 1/19/2013 at 4:50 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(