[jQuery] [validate plugin] How to call a function before the validation start?

[jQuery] [validate plugin] How to call a function before the validation start?


Hi, I'm using the validate plugin, I have a comment form where I want to
leave the possibility to insert an anonymous comment, but I want to
alert the user before the submit.
Then, if I have this code, what I have to do, to add a confirm('Are you
sure')?
I'm looking for a method like "onBeforeSubmit" :-)
Thank you.
if($('#commenti_form').size() > 0) {
$("#commenti_form").validate({
invalidHandler: function(form, validator) {
var errors = validator.numberOfInvalids();
if (errors) {
$("div#error_container").show();
} else {
$("div#error_container").hide();
}
},
onfocusout: false,
onkeyup: false,
onclick:false,
meta: "validate",
errorClass: "invalid",
errorPlacement: function(error, element) {
$labelToAppendTo = $('label[for='+element[0].id+']');

error.appendTo($("div#error_container")).clone().appendTo($labelToAppendTo);
$('<br />').appendTo($("div#error_container"));
}
});
}
--
gianiaz.net - web solutions
via angelo custode, 10 - 23100 sondrio (so) - italy
+39 347 7196482