jQuery-validate in MVC

Boy, is debugging in a strongly typed language easier than in JavaScript.

I’m really glad to have NuGet in Visual Studio. Of course, I immediately ran “Update-Package jQuery”, and then merrily went along until I later discovered that my login and registration pages weren’t working anymore.  The IE9 and Visual Studio debuggers were kind enough to give me this error in jquery.validate.unobtrusive.min.js:

Line: 5
Error: Unable to set value of the property 'unobtrusive': object is null or undefined

I could see there was a variable named “d” with an property named “unobtrusive”, but the value of “d” was unknown in the debugger.

Of course I went down a couple of false paths, and tried to enable client-side verification and unobtrusive JavaScript in web.config.  I finally found a StackOverflow post stating that the latest version of jquery-validate isn’t working on several versions of Internet Explorer.  I can’t say I’ve given that deep testing, but it seems plausible.

I don’t know how much searching through code I would have done without finding a workaround or fix.

I rolled back to jquery-1.5.1, and everything was fine.

It is nice to know that there’s a version flag in NuGet’s Install-Package, so that you can pick legacy versions of packages for these situations.

 PM> Install-Package jQuery -version 1.5.1
Successfully installed 'jQuery 1.5.1'.
OrderManagementWeb already has a reference to 'jQuery 1.5.1'.

Technorati Tags: IE9,NuGet,Visual Studio,Internet Explorer,jQuery

Windows Live Tags: IE9,NuGet,Visual Studio,Internet Explorer,jQuery