Blair McBride schrieb:
With the Validate plugin, when settings.submitHandler is set and user
tries to submit the form, the script intercepts this and will always
block the submission (by returning false from the onsubmit event).

This can easily be extended to allow the submitHandler function to
return a boolean value, when can then in turn be the return value for
the onsubmit event.

For example, this would allow:

$('#myform').validate({
submitHandler: function(form) {
return window.confirm('Are you sure?');
}
});
You could just as easily write this:

$('#myform').validate({
 submitHandler: function(form) {
   if (window.confirm('Are you sure?'))
     form.submit();
 }
});


Though that doesn't require a change in the validation plugin and you don't have to return anything at all if that isn't wanted anyway.

Let me know if that works for you.

Jörn

Reply via email to