Reputation: 567
Is it possible to send the Validate error message to other function? As an example, I have a notification function that displays a determined message and fades away after (n) seconds:
notify("My error message", { selector: '#form-notification' });
How to use that notify function with this:
$("#myForm").validate({
submitHandler: function(form) {
var options = {
target: '#save_form',
dataType: 'json',
beforeSubmit: showRequest,
success: showResponse
};
$(form).ajaxSubmit(options);
}
});
Thanks in advance.
Upvotes: 0
Views: 596
Reputation: 7032
You can use the showErrors
callback to customize what happens when an error occurs. Include defaultShowErrors()
to keep the default action.
$("#myForm").validate({
showErrors: function(errorMap, errorList) {
//custom code here
this.defaultShowErrors();
}
});
http://docs.jquery.com/Plugins/Validation/validate
Upvotes: 2