Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MVC3 unobtrusive validation not working in IE

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.

like image 279
monstro Avatar asked Feb 11 '13 18:02

monstro


2 Answers

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'.

like image 113
BillD Avatar answered Oct 25 '22 16:10

BillD


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

like image 2
Brett Avatar answered Oct 25 '22 18:10

Brett