jQuery Validation 1.10 and MVC server-side errors

Posted by sam360 on Stack Overflow See other posts from Stack Overflow or by sam360
Published on 2012-11-10T05:11:36Z Indexed on 2012/11/30 17:04 UTC
Read the original article Hit count: 276

This feature used to work just fine on my website.

If I added a custom error to ModelState, the input on the page would be marked as "input-validation-error" and the Html.ValidationMessage() would take care of rendering a span with the error message inside it.

Due to incompatibility reasons we had to upgrade our jQuery Validation to 1.10:

Now when I add a custom error to ModelState, I can debug and see that the HTML elements being rendered correctly, but as soon as the page load is completed, jQuery Validation removes the error message and set the "class" attribute of the input to "valid"!

Has any one else come across this issue?

UPDATE

Testing further shows that the error message is shown on the screen until the field gains focus. As soon as the field gains focus jQuery Validation removes the customer server-side error message and marks the field as good.

© Stack Overflow or respective owner

Related posts about asp.net-mvc

Related posts about jquery-validation-plugin