FIxes in async validations (in sync case), closes 214
This commit is contained in:
parent
ded757bd50
commit
358f7b788c
|
@ -351,12 +351,16 @@ Validatable.prototype.isValid = function (callback) {
|
|||
});
|
||||
|
||||
this.trigger('validation', function (validationsDone) {
|
||||
var inst = this;
|
||||
var inst = this,
|
||||
asyncFail = false;
|
||||
|
||||
this.constructor._validations.forEach(function (v) {
|
||||
if (v[2] && v[2].async) {
|
||||
async = true;
|
||||
wait += 1;
|
||||
validationFailed(inst, v, done);
|
||||
process.nextTick(function () {
|
||||
validationFailed(inst, v, done);
|
||||
});
|
||||
} else {
|
||||
if (validationFailed(inst, v)) {
|
||||
valid = false;
|
||||
|
@ -369,7 +373,6 @@ Validatable.prototype.isValid = function (callback) {
|
|||
validationsDone();
|
||||
}
|
||||
|
||||
var asyncFail = false;
|
||||
function done(fail) {
|
||||
asyncFail = asyncFail || fail;
|
||||
if (--wait === 0 && callback) {
|
||||
|
|
Loading…
Reference in New Issue