How to hook into error of jQuery validate unobtrusive in MVC 3?
Then you can hook ALL forms from a central place - just be aware all forms will be hooked. Instead of using $("#formId")
in the sample, simply use $("form").submit()
and that delegate will be called for any form's submit and in that method you can call your validate check and return true (to submit the form) or false to prevent it.
Something like this off the top of my head
$("form").submit(function () {
if (!$(this).valid()) {
return false;
}
else
{
return true;
}
});