bcardarella/client_side_validations — Issue #260: redundant calling of form callbacks
Author: kellerapps
Created: 2012-01-26 07:57:54+00:00
State: open

Shouldn't the form callbacks be called once per validation? The each loop below seems to validate the form once per field instead of once per form.

validateForm = function(form, validators) {
var valid;
valid = true;
form.trigger('form:validate:before').find('[data-validate="true"]:input:enabled').each(function() {
if (!$(this).isValid(validators)) valid = false;
if (valid) {
form.trigger('form:validate:pass');
} else {
form.trigger('form:validate:fail');
}
return form.trigger('form:validate:after');
});
return valid;
};