8

I have MVC3 app, unobtrusive validation works fine in FireFox, but not working in IE.

Any ideas why?

UPDATE

It seems that jQuery unobtrusive validation library that comes with MVC3 is not fully compatible with jQuery 1.7.1 that I am using (that came with bootstrap template). Works in Firefox, doesnt work with IE 8 (the one I have).

I started to upgrade jQuery to the version where it begins to work (not sure though if other things don't break!).

When I got to 1.8.1 it finally worked.

I continued upgrading jQuery, when I got to 1.9.1 - the damn thing stopped working again :)

The latest jQuery version that worked for me with MVC3 jQuery unobtrusive validation is 1.8.3.

Looks like this is also the latest jQuery version what workes with MVC3 jQuery unobtrusive ajax library.

P.S. People using MVC3 unobtrusive validation or ajax, dont use jQuery higher than v 1.8.3.

monstro
  • 6,254
  • 10
  • 65
  • 111

3 Answers3

7

I had similar problems recently, with IE7 and IE8 only (with MVC4).

To get validation working again, I have the following versions installed:

jQuery: 1.8.3

jQuery Validation: 1.9.0.1

Microsoft Unobtrusive Validation: 2.0.30116.0 (latest as of May 14, 2013)

I noticed that moving to jQuery Validation v1.10 was where the problems began. At the time of this post JQuery Validation is v1.11.1 and does not work in IE7/8. This was also tried with both jQuery 1.8.3 and 1.9.1, neither worked with the latest version of jQuery Validation.

Note: The particular problem for me was validation was firing and flagging error for all inputs and checkboxes even if they were not 'data-required'.

BillD
  • 161
  • 3
  • 7
  • I was just experiencing this myself in the same setup. I had to roll back all the way to jQuery 1.5.1 in order for this script to work. – MacSalty Jun 14 '13 at 17:55
  • I have followings. But still it does not work `jQuery - 2.0.3, jQuery.Validation - 1.11.1, Microsoft.jQuery.Unobtrusive.Validation - 3.0.0` – shashwat Dec 09 '13 at 11:46
  • @shashwat jQuery 2.x has [no support for IE8 and bellow](http://www.sitepoint.com/jquery-2-support-ie6-ie7-ie8/)! – balexandre Sep 24 '14 at 16:45
2

I had a very similar problem to what is being described. Using IE9 (Doc Mode: IE9 Standards) I was receiving script errors, where as it worked in any other browser ( and lower IE doc standards).

I releived the problem by using jquery.validate.js (1.11.0)

With this I could use jQuery-1.9.1.js and MVC3.0 jquery.validate.unobtrusive

Brett
  • 1,140
  • 10
  • 16
  • Based on my tests, the best latest combination that works with MVC3 would be jquery 1.8.3 & jquery ui 1.9.2. – monstro Mar 01 '13 at 14:21
  • Well your original question didn't state which error it was giving as a result of using such script versions. Just saying my problem was resolved using the very latest version of jquery.validate.js - I was getting errors with objects within jquery.validate.unobtrusive before hand. I am also using jquery-ui 1.10.1 and all seems well – Brett Mar 01 '13 at 17:20
2

At the moment of writing (September 2014) I tested the following combination and for me (with IE8 and surprise, even with IE7!) this works:

  • jQuery 1.11.1 (latest 1.x version)
  • jQuery.Validation 1.10.0
  • Microsoft.jQuery.Unobtrusive.Ajax 3.2.2 (last available version)
  • Microsoft.jQuery.Unobtrusive.Validation 3.2.2 (last available version)

Note, with IE 11 (edge) sometimes I get (if I open the Debugger with F12) the following error:

SCRIPT5007: Unable to get property 'call' of undefined or null reference File: jquery.validate.js, Line: 1234, Column: 5

But if I close the debugger and use the form as a normal user, if works fine.

Tested also with IE10 and IE9 (IE11 emulating these). No problems found so far.

If you are unable to update (downgrade) the nuget packages because you get a dependency error (jquery 1.4 or so), remember to use the -IgnoreDependencies flag, for example:

Update-Package jQuery.Validation -Version 1.10.0 -IgnoreDependencies

Enjoy (well, supporting IE8 is not really enjoying, but if you are here it means you are working with customers who can't get rid of this crappy browser...). Cheers ;)

firepol
  • 1,731
  • 22
  • 39