Browse Source

update remote validator completeRequest

khangvu 12 years ago
parent
commit
0b3bcc6c36
3 changed files with 15 additions and 3 deletions
  1. 7 1
      dist/js/bootstrapValidator.js
  2. 1 1
      dist/js/bootstrapValidator.min.js
  3. 7 1
      src/js/bootstrapValidator.js

+ 7 - 1
dist/js/bootstrapValidator.js

@@ -51,7 +51,7 @@
                                 that.validateField(field);
                             }
                         }
-                        if (!that.isValid()) {
+                        if (!that.isValid() || that.numPendingRequests == null) {
                             e.preventDefault();
                         }
                     }
@@ -181,6 +181,12 @@
         },
 
         completeRequest: function($field, validatorName, isValid) {
+            if (isValid === false ) {
+                this.showError($field, validatorName);
+            } else if (isValid === true ) {
+                this.removeError($field);
+            }
+
             var field = $field.attr('name');
 
             this.numPendingRequests--;

File diff suppressed because it is too large
+ 1 - 1
dist/js/bootstrapValidator.min.js


+ 7 - 1
src/js/bootstrapValidator.js

@@ -51,7 +51,7 @@
                                 that.validateField(field);
                             }
                         }
-                        if (!that.isValid()) {
+                        if (!that.isValid() || that.numPendingRequests == null) {
                             e.preventDefault();
                         }
                     }
@@ -181,6 +181,12 @@
         },
 
         completeRequest: function($field, validatorName, isValid) {
+            if (isValid === false ) {
+                this.showError($field, validatorName);
+            } else if (isValid === true ) {
+                this.removeError($field);
+            }
+
             var field = $field.attr('name');
 
             this.numPendingRequests--;