Skip to content

Commit

Permalink
Fix validations
Browse files Browse the repository at this point in the history
  • Loading branch information
1602 committed Mar 31, 2013
1 parent 0776c51 commit 6449f1c
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions lib/validations.js
Expand Up @@ -374,15 +374,22 @@ Validatable.prototype.isValid = function (callback, data) {
});

if (!async) {
validationsDone.call(inst, callback);
validationsDone.call(inst, function() {
if (valid) cleanErrors(inst);
if (callback) {
callback(valid);
}
});
}

function done(fail) {
asyncFail = asyncFail || fail;
if (--wait === 0 && callback) {
if (--wait === 0) {
validationsDone.call(inst, function () {
if (valid && !asyncFail) cleanErrors(inst);
callback(valid && !asyncFail);
if (callback) {
callback(valid && !asyncFail);
}
});
}
}
Expand Down

0 comments on commit 6449f1c

Please sign in to comment.