I have a very complex form with the validation working correctly. However, since it can take awhile for the validation to complete, I'd like to use blockUI to be called when I click the form's submit button to prevent confusion and double-submissions. I can't quite figure out how to do this.
My code looks like this:
$("#credential").validate({
rules: {
EngId: {
required: true
}
ClientAccount: {
required: true
}
...
}
and I'm calling the validation with several buttons (using their click function) depending on selections in the form, often disabling some of the rules:
$("#buttonname").click(function() {
$("#fieldname").rules("remove");
...
$("#credential").submit();
});
What I can't figure out is where the blockui and unblockui calls would go so that when the user clicks the button, before validation starts, blockui does its magic, and if the validation finds a problem, unblockui is called and enables the form again.
I'm pretty new to Jquery and I can't find any examples that I've been able to implement successfully. I would appreciate any help anyone could give (please excuse if this has been covered before).