validate all onSubmit
This commit is contained in:
parent
7f76b1735b
commit
08e4195f97
4 changed files with 20 additions and 10 deletions
File diff suppressed because one or more lines are too long
2
js/out/jquery.idealforms.min.js
vendored
2
js/out/jquery.idealforms.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -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) });
|
||||
}
|
||||
};
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
Loading…
Reference in a new issue