Browse Source

#52: Callback validator does not process if the field is empty

nghuuphuoc 12 years ago
parent
commit
d15745b3c8

+ 4 - 0
CHANGELOG.md

@@ -1,5 +1,9 @@
 # Change Log
 
+## v0.2.3
+
+* [#52: Callback validator does not process if the field is empty](https://github.com/nghuuphuoc/bootstrapvalidator/issues/52)
+
 ## v0.2.2 (2014-01-07)
 
 * [#15: Focus to the first invalid element](https://github.com/nghuuphuoc/bootstrapvalidator/issues/15)

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

@@ -1,5 +1,5 @@
 /**
- * BootstrapValidator v0.2.2 (http://github.com/nghuuphuoc/bootstrapvalidator)
+ * BootstrapValidator v0.2.3 (http://github.com/nghuuphuoc/bootstrapvalidator)
  *
  * A jQuery plugin to validate form fields. Use with Bootstrap 3
  *

+ 2 - 6
dist/js/bootstrapValidator.js

@@ -1,5 +1,5 @@
 /**
- * BootstrapValidator v0.2.2 (http://github.com/nghuuphuoc/bootstrapvalidator)
+ * BootstrapValidator v0.2.3 (http://github.com/nghuuphuoc/bootstrapvalidator)
  *
  * A jQuery plugin to validate form fields. Use with Bootstrap 3
  *
@@ -345,7 +345,7 @@
                 return false;
             }
             for (var field in this.invalidFields) {
-                if (this.invalidFields[field]) {
+                if (this.invalidFields[field] && !this.getFieldElement(field).is(':disabled')) {
                     return false;
                 }
             }
@@ -413,10 +413,6 @@
          */
         validate: function(validator, $field, options) {
             var value = $field.val();
-            if (value == '') {
-                return true;
-            }
-
             if (options.callback && 'function' == typeof options.callback) {
                 return options.callback.call(this, value, this);
             }

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


+ 1 - 1
package.json

@@ -13,5 +13,5 @@
     "grunt-contrib-cssmin": "~0.6.2",
     "grunt-contrib-copy": "~0.4.1"
   },
-  "version": "0.2.2"
+  "version": "0.2.3"
 }

+ 1 - 1
src/js/bootstrapValidator.js

@@ -345,7 +345,7 @@
                 return false;
             }
             for (var field in this.invalidFields) {
-                if (this.invalidFields[field]) {
+                if (this.invalidFields[field] && !this.getFieldElement(field).is(':disabled')) {
                     return false;
                 }
             }

+ 0 - 4
src/js/validator/callback.js

@@ -16,10 +16,6 @@
          */
         validate: function(validator, $field, options) {
             var value = $field.val();
-            if (value == '') {
-                return true;
-            }
-
             if (options.callback && 'function' == typeof options.callback) {
                 return options.callback.call(this, value, this);
             }