ソースを参照

update remote validator completeRequest

khangvu 12 年 前
コミット
0b3bcc6c36

+ 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--;

ファイルの差分が大きいため隠しています
+ 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--;