Browse Source

#389: When using multiple forms with HTML attributes on the same page, the plugin options will be the same as the last one

nghuuphuoc 11 years ago
parent
commit
f621b052b2

+ 1 - 0
CHANGELOG.md

@@ -50,6 +50,7 @@ __Bug Fixes__
 * [#325](https://github.com/nghuuphuoc/bootstrapvalidator/issues/325): The [```threshold``` option](http://bootstrapvalidator.com/settings/#threshold) doesn't work on IE 8
 * [#358](https://github.com/nghuuphuoc/bootstrapvalidator/issues/358): The [```zipCode``` validator](http://bootstrapvalidator.com/validators/zipCode/) doesn't work for Canadian zip code
 * [#377](https://github.com/nghuuphuoc/bootstrapvalidator/issues/377): The [id](http://bootstrapvalidator.com/validators/id/), [vat](http://bootstrapvalidator.com/validators/vat/) validators should return ```false``` if the country code is not supported
+* [#389](https://github.com/nghuuphuoc/bootstrapvalidator/issues/389): When using multiple forms with HTML attributes on the same page, the plugin options will be the same as the last one
 
 __Document__
 * [#259](https://github.com/nghuuphuoc/bootstrapvalidator/issues/259): Typo "Support almost Bootstrap forms", thanks to [@lloydde](https://github.com/lloydde)

+ 2 - 2
dist/js/bootstrapValidator.js

@@ -142,7 +142,7 @@
         live: 'enabled',
 
         // Map the field name with validator rules
-        fields: {}
+        fields: null
     };
 
     BootstrapValidator.prototype = {
@@ -267,7 +267,7 @@
                 emptyOptions    = $.isEmptyObject(opts),        // Check if the field options are set using HTML attributes
                 emptyValidators = $.isEmptyObject(validators);  // Check if the field validators are set using HTML attributes
 
-            if (!emptyValidators || (!emptyOptions && this.options.fields[field])) {
+            if (!emptyValidators || (!emptyOptions && this.options.fields && this.options.fields[field])) {
                 opts.validators = validators;
                 return opts;
             } else {

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


+ 2 - 2
src/js/bootstrapValidator.js

@@ -141,7 +141,7 @@
         live: 'enabled',
 
         // Map the field name with validator rules
-        fields: {}
+        fields: null
     };
 
     BootstrapValidator.prototype = {
@@ -266,7 +266,7 @@
                 emptyOptions    = $.isEmptyObject(opts),        // Check if the field options are set using HTML attributes
                 emptyValidators = $.isEmptyObject(validators);  // Check if the field validators are set using HTML attributes
 
-            if (!emptyValidators || (!emptyOptions && this.options.fields[field])) {
+            if (!emptyValidators || (!emptyOptions && this.options.fields && this.options.fields[field])) {
                 opts.validators = validators;
                 return opts;
             } else {