Browse Source

Fix the issue caused by setting excluded fields as string

nghuuphuoc 11 years ago
parent
commit
9bc2349788
3 changed files with 17 additions and 15 deletions
  1. 8 7
      dist/js/bootstrapValidator.js
  2. 1 1
      dist/js/bootstrapValidator.min.js
  3. 8 7
      src/js/bootstrapValidator.js

+ 8 - 7
dist/js/bootstrapValidator.js

@@ -235,13 +235,6 @@
                     });
 
             this.options = $.extend(true, this.options, options);
-            if ('string' == typeof this.options.excluded) {
-                this.options.excluded = $.map(this.options.excluded.split(','), function(item) {
-                    // Trim the spaces
-                    return $.trim(item);
-                });
-            }
-
             for (var field in this.options.fields) {
                 this._initField(field);
             }
@@ -404,6 +397,14 @@
          */
         _isExcluded: function($field) {
             if (this.options.excluded) {
+                // Convert to array first
+                if ('string' == typeof this.options.excluded) {
+                    this.options.excluded = $.map(this.options.excluded.split(','), function(item) {
+                        // Trim the spaces
+                        return $.trim(item);
+                    });
+                }
+
                 var length = this.options.excluded.length;
                 for (var i = 0; i < length; i++) {
                     if (('string' == typeof this.options.excluded[i] && $field.is(this.options.excluded[i]))

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


+ 8 - 7
src/js/bootstrapValidator.js

@@ -234,13 +234,6 @@
                     });
 
             this.options = $.extend(true, this.options, options);
-            if ('string' == typeof this.options.excluded) {
-                this.options.excluded = $.map(this.options.excluded.split(','), function(item) {
-                    // Trim the spaces
-                    return $.trim(item);
-                });
-            }
-
             for (var field in this.options.fields) {
                 this._initField(field);
             }
@@ -403,6 +396,14 @@
          */
         _isExcluded: function($field) {
             if (this.options.excluded) {
+                // Convert to array first
+                if ('string' == typeof this.options.excluded) {
+                    this.options.excluded = $.map(this.options.excluded.split(','), function(item) {
+                        // Trim the spaces
+                        return $.trim(item);
+                    });
+                }
+
                 var length = this.options.excluded.length;
                 for (var i = 0; i < length; i++) {
                     if (('string' == typeof this.options.excluded[i] && $field.is(this.options.excluded[i]))