Browse Source

Add bv param to the data of status.field.bv event

phuoc 11 years ago
parent
commit
bea5602669

+ 5 - 8
demo/event.html

@@ -44,7 +44,6 @@
                             </div>
                         </div>
 
-                        <!--
                         <div class="form-group">
                             <label class="col-lg-3 control-label">Password</label>
                             <div class="col-lg-5">
@@ -156,7 +155,6 @@
                                 </div>
                             </div>
                         </div>
-                        -->
 
                         <div class="form-group">
                             <div class="col-lg-9 col-lg-offset-3">
@@ -211,10 +209,10 @@ $(document).ready(function() {
                             regexp: /^[a-zA-Z0-9_\.]+$/,
                             message: 'The username can only consist of alphabetical, number, dot and underscore'
                         },
-                        remote: {
-                            url: 'remote.php',
-                            message: 'The username is not available'
-                        },
+//                        remote: {
+//                            url: 'remote.php',
+//                            message: 'The username is not available'
+//                        },
                         different: {
                             field: 'password',
                             message: 'The username and password cannot be the same as each other'
@@ -306,12 +304,11 @@ $(document).ready(function() {
             console.log('success.field.bv -->', data);
         })
         .on('status.field.bv', function(e, data) {
-            var $form = $(e.target);
             // I don't want to add has-success class to valid field container
             data.element.parents('.form-group').removeClass('has-success');
 
             // I want to enable the submit button all the time
-            $form.data('bootstrapValidator').disableSubmitButtons(false);
+            data.bv.disableSubmitButtons(false);
         });
 
     // Validate the form manually

+ 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.0-dev, built on 2014-07-14 10:41:12 AM
+ * @version     v0.5.0-dev, built on 2014-07-14 10:49:46 AM
  * @author      https://twitter.com/nghuuphuoc
  * @copyright   (c) 2013 - 2014 Nguyen Huu Phuoc
  * @license     MIT

+ 2 - 1
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.0-dev, built on 2014-07-14 10:41:12 AM
+ * @version     v0.5.0-dev, built on 2014-07-14 10:49:46 AM
  * @author      https://twitter.com/nghuuphuoc
  * @copyright   (c) 2013 - 2014 Nguyen Huu Phuoc
  * @license     MIT
@@ -957,6 +957,7 @@
 
                 // Trigger an event
                 $field.trigger($.Event('status.field.bv'), {
+                    bv: this,
                     field: field,
                     element: $field,
                     status: status

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


+ 1 - 0
src/js/bootstrapValidator.js

@@ -956,6 +956,7 @@
 
                 // Trigger an event
                 $field.trigger($.Event('status.field.bv'), {
+                    bv: this,
                     field: field,
                     element: $field,
                     status: status