Browse Source

#914: Revert identical to previous version

phuoc 11 years ago
parent
commit
57b800f2f1

+ 0 - 1
CHANGELOG.md

@@ -15,7 +15,6 @@ __New Features__
 
 __Improvements__
 * [#823](https://github.com/nghuuphuoc/bootstrapvalidator/issues/823): The [hexColor](http://bootstrapvalidator.com/validators/hexColor/) validator only accepts 6 hex character values when using HTML 5 ```type='color'``` attribute
-* [#854](https://github.com/nghuuphuoc/bootstrapvalidator/issues/854), [#914](https://github.com/nghuuphuoc/bootstrapvalidator/issues/914): Improve behaviour of the [identical](http://bootstrapvalidator.com/validators/identical/) validator
 * [#864](https://github.com/nghuuphuoc/bootstrapvalidator/pull/864): Coma separator handling in [greaterThan](http://bootstrapvalidator.com/validators/greaterThan/), [lessThan](http://bootstrapvalidator.com/validators/lessThan/) validators, thanks to [@mgibas](https://github.com/mgibas)
 * [#999](https://github.com/nghuuphuoc/bootstrapvalidator/pull/999), [#1048](https://github.com/nghuuphuoc/bootstrapvalidator/issues/1048): Replace ',' with '.' to validate decimal numbers correct, thanks to [@johanronn77](https://github.com/johanronn77)
 * [#1002](https://github.com/nghuuphuoc/bootstrapvalidator/pull/1002): Put tooltip/popover on bottom if there is not enough space on top, thanks to [@jazzzz](https://github.com/jazzzz)

+ 3 - 3
demo/index.html

@@ -272,9 +272,9 @@ $(document).ready(function() {
             },
             confirmPassword: {
                 validators: {
-                    notEmpty: {
-                        message: 'The confirm password is required and cannot be empty'
-                    },
+//                    notEmpty: {
+//                        message: 'The confirm password is required and cannot be empty'
+//                    },
                     identical: {
                         field: 'password',
                         message: 'The password and its confirm are not the same'

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

@@ -2,7 +2,7 @@
  * BootstrapValidator (http://bootstrapvalidator.com)
  * The best jQuery plugin to validate form fields. Designed to use with Bootstrap 3
  *
- * @version     v0.5.3-dev, built on 2014-11-01 5:18:27 PM
+ * @version     v0.5.3-dev, built on 2014-11-02 4:33:10 PM
  * @author      https://twitter.com/nghuuphuoc
  * @copyright   (c) 2013 - 2014 Nguyen Huu Phuoc
  * @license     MIT

+ 5 - 10
dist/js/bootstrapValidator.js

@@ -2,7 +2,7 @@
  * BootstrapValidator (http://bootstrapvalidator.com)
  * The best jQuery plugin to validate form fields. Designed to use with Bootstrap 3
  *
- * @version     v0.5.3-dev, built on 2014-11-01 5:18:27 PM
+ * @version     v0.5.3-dev, built on 2014-11-02 4:33:10 PM
  * @author      https://twitter.com/nghuuphuoc
  * @copyright   (c) 2013 - 2014 Nguyen Huu Phuoc
  * @license     MIT
@@ -4969,17 +4969,12 @@ if (typeof jQuery === 'undefined') {
                 return true;
             }
 
-            var compareValue = compareWith.val();
-            if (compareValue === '') {
-                return true;
-            }
-
-            if (value === compareValue) {
-                validator.updateStatus(compareWith, validator.STATUS_VALID, 'identical');
+            if (value === compareWith.val()) {
+                validator.updateStatus(options.field, validator.STATUS_VALID, 'identical');
                 return true;
+            } else {
+                return false;
             }
-
-            return false;
         }
     };
 }(window.jQuery));

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


+ 4 - 9
src/js/validator/identical.js

@@ -29,17 +29,12 @@
                 return true;
             }
 
-            var compareValue = compareWith.val();
-            if (compareValue === '') {
+            if (value === compareWith.val()) {
+                validator.updateStatus(options.field, validator.STATUS_VALID, 'identical');
                 return true;
+            } else {
+                return false;
             }
-
-            if (value === compareValue) {
-                validator.updateStatus(compareWith, validator.STATUS_VALID, 'identical');
-                return true;
-            }
-
-            return false;
         }
     };
 }(window.jQuery));