Browse Source

Update different and identical validators due to validator.getFieldElements() modification

nghuuphuoc 11 years ago
parent
commit
416ae1be71

+ 14 - 6
dist/js/bootstrapValidator.js

@@ -388,9 +388,13 @@
                 return true;
             }
 
-            var $compareWith = validator.getFieldElement(options.field);
-            if ($compareWith && value != $compareWith.val()) {
-                validator.removeError($compareWith);
+            var compareWith = validator.getFieldElements(options.field);
+            if (compareWith == null) {
+                return true;
+            }
+
+            if (value != compareWith.val()) {
+                validator.removeError(compareWith);
                 return true;
             } else {
                 return false;
@@ -501,9 +505,13 @@
                 return true;
             }
 
-            var $compareWith = validator.getFieldElement(options.field);
-            if ($compareWith && value == $compareWith.val()) {
-                validator.removeError($compareWith);
+            var compareWith = validator.getFieldElements(options.field);
+            if (compareWith == null) {
+                return true;
+            }
+
+            if (value == compareWith.val()) {
+                validator.removeError(compareWith);
                 return true;
             } else {
                 return false;

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


+ 7 - 3
src/js/validator/different.js

@@ -15,9 +15,13 @@
                 return true;
             }
 
-            var $compareWith = validator.getFieldElement(options.field);
-            if ($compareWith && value != $compareWith.val()) {
-                validator.removeError($compareWith);
+            var compareWith = validator.getFieldElements(options.field);
+            if (compareWith == null) {
+                return true;
+            }
+
+            if (value != compareWith.val()) {
+                validator.removeError(compareWith);
                 return true;
             } else {
                 return false;

+ 7 - 3
src/js/validator/identical.js

@@ -15,9 +15,13 @@
                 return true;
             }
 
-            var $compareWith = validator.getFieldElement(options.field);
-            if ($compareWith && value == $compareWith.val()) {
-                validator.removeError($compareWith);
+            var compareWith = validator.getFieldElements(options.field);
+            if (compareWith == null) {
+                return true;
+            }
+
+            if (value == compareWith.val()) {
+                validator.removeError(compareWith);
                 return true;
             } else {
                 return false;