Browse Source

#39: Validate existing fields only

nghuuphuoc 12 years ago
parent
commit
ad7d513222

+ 16 - 15
CHANGELOG.md

@@ -2,31 +2,32 @@
 
 
 ## v0.2.2
 ## v0.2.2
 
 
-* Fixed #34: Avoid from calling form submit recursively
-* Improved #15: Focus to the first invalid element
-* Improved #31: remote validator: Allow to set additional data to remote URL
+* (#15) Focus to the first invalid element
+* (#31) ```remote``` validator: Allow to set additional data to remote URL
+* (#34) Avoid from calling form submit recursively
+* (#39) Validate existing fields only
 
 
 ##v0.2.1 (2013-11-08)
 ##v0.2.1 (2013-11-08)
 
 
-* Fixed #29: Upgrade Bootstrap to v3.0.2
-* Fixed #30: Hide the error block containers before validating
+* (#29) Upgrade Bootstrap to v3.0.2
+* (#30) Hide the error block containers before validating
 
 
 ## v0.2.0 (2013-10-21)
 ## v0.2.0 (2013-10-21)
 
 
-* Added #9: Add ```creditCard``` validator
-* Added #18: Add ```different``` validator
-* Added #20: Add custom submit handler (using ```submitHandler``` option)
-* Added #21: Add ```callback``` validator
-* Added #24: Add ```live``` option
-* Fixed #25: The ```regexp``` validator does not work
-* Improved #22: Support form that labels are placed in extra small (```col-xs-```), small (```col-sm-```), medium (```col-md-```) elements
+* (#9) Add ```creditCard``` validator
+* (#18) Add ```different``` validator
+* (#20) Add custom submit handler (using ```submitHandler``` option)
+* (#21) Add ```callback``` validator
+* (#22) Support form that labels are placed in extra small (```col-xs-```), small (```col-sm-```), medium (```col-md-```) elements
+* (#24) Add ```live``` option
+* (#25) The ```regexp``` validator does not work
 
 
 ## v0.1.1 (2013-10-17)
 ## v0.1.1 (2013-10-17)
 
 
 * Add ```submitButtons``` option
 * Add ```submitButtons``` option
-* Added #17: Support default Bootstrap form without labels
-* Added #19: Support select box validator
-* Fixed #16: Disable client side validation in HTML 5
+* (#16) Disable client side validation in HTML 5
+* (#17) Support default Bootstrap form without labels
+* (#19) Support select box validator
 
 
 ## v0.1.0 (2013-10-14)
 ## v0.1.0 (2013-10-14)
 
 

+ 2 - 0
demo/index.html

@@ -49,12 +49,14 @@
                             </div>
                             </div>
                         </div>
                         </div>
 
 
+                        <!--
                         <div class="form-group">
                         <div class="form-group">
                             <label class="col-lg-3 control-label" id="captchaOperation"></label>
                             <label class="col-lg-3 control-label" id="captchaOperation"></label>
                             <div class="col-lg-2">
                             <div class="col-lg-2">
                                 <input type="text" class="form-control" name="captcha" />
                                 <input type="text" class="form-control" name="captcha" />
                             </div>
                             </div>
                         </div>
                         </div>
+                        -->
 
 
                         <div class="form-group">
                         <div class="form-group">
                             <div class="col-lg-9 col-lg-offset-3">
                             <div class="col-lg-9 col-lg-offset-3">

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

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

+ 3 - 4
dist/js/bootstrapValidator.js

@@ -1,5 +1,5 @@
 /**
 /**
- * BootstrapValidator v0.2.2 (http://github.com/nghuuphuoc/bootstrapvalidator)
+ * BootstrapValidator v0.2.2-dev (http://github.com/nghuuphuoc/bootstrapvalidator)
  *
  *
  * A jQuery plugin to validate form fields. Use with Bootstrap 3
  * A jQuery plugin to validate form fields. Use with Bootstrap 3
  *
  *
@@ -81,7 +81,7 @@
                             if (that.numPendingRequests > 0 || that.numPendingRequests == null) {
                             if (that.numPendingRequests > 0 || that.numPendingRequests == null) {
                                 // Check if the field is valid
                                 // Check if the field is valid
                                 var $field = that.getFieldElement(field);
                                 var $field = that.getFieldElement(field);
-                                if ($field.data('bootstrapValidator.isValid') !== true) {
+                                if ($field && $field.data('bootstrapValidator.isValid') !== true) {
                                     that.validateField(field);
                                     that.validateField(field);
                                 }
                                 }
                             }
                             }
@@ -160,8 +160,7 @@
             }
             }
 
 
             // Create a help block element for showing the error
             // Create a help block element for showing the error
-            var that      = this,
-                $parent   = $field.parents('.form-group'),
+            var $parent   = $field.parents('.form-group'),
                 helpBlock = $parent.find('.help-block');
                 helpBlock = $parent.find('.help-block');
 
 
             if (helpBlock.length == 0) {
             if (helpBlock.length == 0) {

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-cssmin": "~0.6.2",
     "grunt-contrib-copy": "~0.4.1"
     "grunt-contrib-copy": "~0.4.1"
   },
   },
-  "version": "0.2.2"
+  "version": "0.2.2-dev"
 }
 }

+ 2 - 3
src/js/bootstrapValidator.js

@@ -81,7 +81,7 @@
                             if (that.numPendingRequests > 0 || that.numPendingRequests == null) {
                             if (that.numPendingRequests > 0 || that.numPendingRequests == null) {
                                 // Check if the field is valid
                                 // Check if the field is valid
                                 var $field = that.getFieldElement(field);
                                 var $field = that.getFieldElement(field);
-                                if ($field.data('bootstrapValidator.isValid') !== true) {
+                                if ($field && $field.data('bootstrapValidator.isValid') !== true) {
                                     that.validateField(field);
                                     that.validateField(field);
                                 }
                                 }
                             }
                             }
@@ -160,8 +160,7 @@
             }
             }
 
 
             // Create a help block element for showing the error
             // Create a help block element for showing the error
-            var that      = this,
-                $parent   = $field.parents('.form-group'),
+            var $parent   = $field.parents('.form-group'),
                 helpBlock = $parent.find('.help-block');
                 helpBlock = $parent.find('.help-block');
 
 
             if (helpBlock.length == 0) {
             if (helpBlock.length == 0) {