Browse Source

#548: Fix the issue when using different validator to compare with not existing field

phuoc 11 years ago
parent
commit
52ca13de07

+ 1 - 0
CHANGELOG.md

@@ -28,6 +28,7 @@ __Improvements__
 __Bug Fixes__
 __Bug Fixes__
 
 
 * [#284](https://github.com/nghuuphuoc/bootstrapvalidator/issues/284), [#294](https://github.com/nghuuphuoc/bootstrapvalidator/issues/294), [#441](https://github.com/nghuuphuoc/bootstrapvalidator/issues/441), [#516](https://github.com/nghuuphuoc/bootstrapvalidator/issues/516): The HTML 5 ```<input type="number" />``` input allows to input non-digits characters
 * [#284](https://github.com/nghuuphuoc/bootstrapvalidator/issues/284), [#294](https://github.com/nghuuphuoc/bootstrapvalidator/issues/294), [#441](https://github.com/nghuuphuoc/bootstrapvalidator/issues/441), [#516](https://github.com/nghuuphuoc/bootstrapvalidator/issues/516): The HTML 5 ```<input type="number" />``` input allows to input non-digits characters
+* [#548](https://github.com/nghuuphuoc/bootstrapvalidator/issues/548): Fix the issue when using [different](http://bootstrapvalidator.com/validators/different/) validator to compare with not existing field
 * [#550](https://github.com/nghuuphuoc/bootstrapvalidator/issues/550), [#551](https://github.com/nghuuphuoc/bootstrapvalidator/pull/551): Cannot validate against both ipv4 and ipv6 at the same time, thanks to [@beeglebug](https://github.com/beeglebug)
 * [#550](https://github.com/nghuuphuoc/bootstrapvalidator/issues/550), [#551](https://github.com/nghuuphuoc/bootstrapvalidator/pull/551): Cannot validate against both ipv4 and ipv6 at the same time, thanks to [@beeglebug](https://github.com/beeglebug)
 * [#588](https://github.com/nghuuphuoc/bootstrapvalidator/issues/588): Don't use min, max attributes (greaterThan, lessThan validators) for ```<input type="date" />```
 * [#588](https://github.com/nghuuphuoc/bootstrapvalidator/issues/588): Don't use min, max attributes (greaterThan, lessThan validators) for ```<input type="date" />```
 * [#665](https://github.com/nghuuphuoc/bootstrapvalidator/issues/665): The [submitButtons](http://bootstrapvalidator.com/settings/#form-submit-buttons) option doesn't work correctly
 * [#665](https://github.com/nghuuphuoc/bootstrapvalidator/issues/665): The [submitButtons](http://bootstrapvalidator.com/settings/#form-submit-buttons) option doesn't work correctly

+ 1 - 1
dist/css/bootstrapValidator.min.css

@@ -2,7 +2,7 @@
  * BootstrapValidator (http://bootstrapvalidator.com)
  * BootstrapValidator (http://bootstrapvalidator.com)
  * The best jQuery plugin to validate form fields. Designed to use with Bootstrap 3
  * The best jQuery plugin to validate form fields. Designed to use with Bootstrap 3
  *
  *
- * @version     v0.5.1-dev, built on 2014-08-17 4:41:37 PM
+ * @version     v0.5.1-dev, built on 2014-08-17 5:33:31 PM
  * @author      https://twitter.com/nghuuphuoc
  * @author      https://twitter.com/nghuuphuoc
  * @copyright   (c) 2013 - 2014 Nguyen Huu Phuoc
  * @copyright   (c) 2013 - 2014 Nguyen Huu Phuoc
  * @license     MIT
  * @license     MIT

+ 3 - 3
dist/js/bootstrapValidator.js

@@ -2,7 +2,7 @@
  * BootstrapValidator (http://bootstrapvalidator.com)
  * BootstrapValidator (http://bootstrapvalidator.com)
  * The best jQuery plugin to validate form fields. Designed to use with Bootstrap 3
  * The best jQuery plugin to validate form fields. Designed to use with Bootstrap 3
  *
  *
- * @version     v0.5.1-dev, built on 2014-08-17 4:41:37 PM
+ * @version     v0.5.1-dev, built on 2014-08-17 5:33:31 PM
  * @author      https://twitter.com/nghuuphuoc
  * @author      https://twitter.com/nghuuphuoc
  * @copyright   (c) 2013 - 2014 Nguyen Huu Phuoc
  * @copyright   (c) 2013 - 2014 Nguyen Huu Phuoc
  * @license     MIT
  * @license     MIT
@@ -2494,7 +2494,7 @@
             }
             }
 
 
             var compareWith = validator.getFieldElements(options.field);
             var compareWith = validator.getFieldElements(options.field);
-            if (compareWith === null) {
+            if (compareWith === null || compareWith.length === 0) {
                 return true;
                 return true;
             }
             }
 
 
@@ -3911,7 +3911,7 @@
             }
             }
 
 
             var compareWith = validator.getFieldElements(options.field);
             var compareWith = validator.getFieldElements(options.field);
-            if (compareWith === null) {
+            if (compareWith === null || compareWith.length === 0) {
                 return true;
                 return true;
             }
             }
 
 

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


+ 1 - 1
src/js/validator/different.js

@@ -26,7 +26,7 @@
             }
             }
 
 
             var compareWith = validator.getFieldElements(options.field);
             var compareWith = validator.getFieldElements(options.field);
-            if (compareWith === null) {
+            if (compareWith === null || compareWith.length === 0) {
                 return true;
                 return true;
             }
             }
 
 

+ 1 - 1
src/js/validator/identical.js

@@ -25,7 +25,7 @@
             }
             }
 
 
             var compareWith = validator.getFieldElements(options.field);
             var compareWith = validator.getFieldElements(options.field);
-            if (compareWith === null) {
+            if (compareWith === null || compareWith.length === 0) {
                 return true;
                 return true;
             }
             }