[jQuery] (validate) How to get individual error messages and disable auto-showing
I'm trying to write a custom display for the error messages on my
form. Ideally I'd like to use a modal pop-up window to display the
errors, but I'm having trouble figuring out how to prevent the
validation plugin from automatically displaying the errors on my page
AND I can't quite figure out how to access the individual error
messages for the elements on my form.
What I want to do is to allow users to save invalid forms, but to warn
them that they are invalid to make them confirm that they want to
save.
I have something like this:
invalidHandler: function(form, validator) {
//some code here figuring out if specific elements are within
maxlength so as not to blow up the db
if (canSave) { //canSave determined in the comments above
var msg = "There are errors...";
for(errors in validator.errors) {
msg = msg + "<br/>" + errors.message;
}
jConfirm(msg, 'You can still save!', function(r) {
if (r){
document.forms['myform'].submit();
}
else {
}
});
if (
}
else {
jAlert('Cannot save right now', 'Unable to save');
}
}
Can I get access to the list of errors from the validator or even
individually for each element in my form?
and
Can I turn off the auto showing of errors?
Thanks!