I am using ASP.NET MVC 3 with unobtrusive validate JavaScript. I am also using jQuery UI tabs, and I would like to select a tab who contains an element with an invalid message.
So, to do that I need to call a script just after the jquery.validate is evaluated.
I tried some like this:
$(':submit').submit(function () {
var invalidField = $(".input-validation-error");
if (invalidField ) {
tabid = //some script to detect wich tab contains the invalidField
$('#someTabed').tabs('select', tabid));
}
});
It works, but just if I click the submit button TWICE. Which means this method is not called after the event I would like.
So I need to know how to intercept the validate method made by unobtrusive validate, to put my method after that.
I don't think you can intercept the method (I could be wrong but all the postings I've ever seen on this all manually call this.valid), instead you will have to call the validation yourself on post.
How to hook into error of jQuery validate unobtrusive in MVC 3?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With