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.