I'm using the jQuery Tools Validator (jquerytools.org), which by default shows the error message above each field.
Instead, I'd like the error messages to be combined into one regular alert() dialog (the normal JS alert() function).
I don't see that as an option in the documentation. Is there a hack to make this happen?
Thanks for any help you can offer.
For context, the validations are being coded as follows:
$.tools.validator.fn("[minlength]", function(input, value) {
var minlength = input.attr("minlength");
if(value.length != 0 && value.length < minlength) return 'Minimum ' + minlength + ' characters';
else return true;
});
$.tools.validator.fn("[data-validate=name]", function(input, value) {
if(!name_regex.test(value) && value) return 'Contains invalid characters';
else return true;
});
It's not a hack -- you can use the onFail event handlers to do this. http://www.jquerytools.org/demos/validator/events.html
It executes that handler when the form fails to validate, but before it shows any error messages. By returning false, you can create your own error message handling and prevent the validator from displaying errors.