validate all onSubmit

This commit is contained in:
elclanrs 2013-10-09 04:08:48 -04:00
parent 7f76b1735b
commit 08e4195f97
4 changed files with 20 additions and 10 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -15,6 +15,7 @@ module.exports = {
this.$form.submit(function(e) {
e.preventDefault();
self._validateAll();
self.focusFirstInvalid();
self.opts.onSubmit.call(self, self.getInvalid().length, e);
});
@ -169,6 +170,10 @@ module.exports = {
this._inject('_validate', input, rule, valid);
return valid;
}
},
_validateAll: function() {
var self = this;
this.$inputs.each(function(){ self._validate(this, true) });
}
};

View file

@ -15,9 +15,9 @@ module.exports = {
$inputs.each(function(){ self._buildField(this) });
this.$inputs = this.$inputs
.add($inputs)
.each(function(){ self._validate(this, true) });
this.$inputs = this.$inputs.add($inputs);
this._validateAll();
this.$fields.find(this.opts.error).hide();