浏览代码

#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 年之前
父节点
当前提交
f621b052b2
共有 4 个文件被更改,包括 7 次插入6 次删除
  1. 1 0
      CHANGELOG.md
  2. 2 2
      dist/js/bootstrapValidator.js
  3. 2 2
      dist/js/bootstrapValidator.min.js
  4. 2 2
      src/js/bootstrapValidator.js

+ 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 {

文件差异内容过多而无法显示
+ 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 {