Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix validations

  • Loading branch information...
commit 6449f1ca72dfe7c3f2c15391089f368d19a2e7ad 1 parent 0776c51
Anatoliy Chakkaev authored
Showing with 10 additions and 3 deletions.
  1. +10 −3 lib/validations.js
13 lib/validations.js
View
@@ -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);
+ }
});
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.