Browse Source

#184: Use comma to separate the excluded filters

phuoc 12 years ago
parent
commit
b53875e617
3 changed files with 18 additions and 8 deletions
  1. 8 3
      dist/js/bootstrapValidator.js
  2. 2 2
      dist/js/bootstrapValidator.min.js
  3. 8 3
      src/js/bootstrapValidator.js

+ 8 - 3
dist/js/bootstrapValidator.js

@@ -109,7 +109,7 @@
         _init: function() {
             var that    = this,
                 options = {
-                    excluded:       this.$form.attr('data-bv-excluded') ? this.$form.attr('data-bv-excluded').split(' ') : [],
+                    excluded:       this.$form.attr('data-bv-excluded') || [],
                     trigger:        this.$form.attr('data-bv-trigger'),
                     message:        this.$form.attr('data-bv-message'),
                     submitButtons:  this.$form.attr('data-bv-submitbuttons'),
@@ -190,8 +190,13 @@
                     }
                 });
 
-            this.options          = $.extend(true, this.options, options);
-            this.options.excluded = ('string' == typeof this.options.excluded) ? this.options.excluded.split(' ') : this.options.excluded;
+            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 item.trim();
+                });
+            }
 
             for (var field in this.options.fields) {
                 this._initField(field);

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


+ 8 - 3
src/js/bootstrapValidator.js

@@ -108,7 +108,7 @@
         _init: function() {
             var that    = this,
                 options = {
-                    excluded:       this.$form.attr('data-bv-excluded') ? this.$form.attr('data-bv-excluded').split(' ') : [],
+                    excluded:       this.$form.attr('data-bv-excluded') || [],
                     trigger:        this.$form.attr('data-bv-trigger'),
                     message:        this.$form.attr('data-bv-message'),
                     submitButtons:  this.$form.attr('data-bv-submitbuttons'),
@@ -189,8 +189,13 @@
                     }
                 });
 
-            this.options          = $.extend(true, this.options, options);
-            this.options.excluded = ('string' == typeof this.options.excluded) ? this.options.excluded.split(' ') : this.options.excluded;
+            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 item.trim();
+                });
+            }
 
             for (var field in this.options.fields) {
                 this._initField(field);