ソースを参照

Update bootstrapValidator.js

Added two new public methods: addField and removeField. The first adds a new field validation options, and the second removes it.
jcnmulio 11 年 前
コミット
6b1c1b70e3
1 ファイル変更32 行追加0 行削除
  1. 32 0
      dist/js/bootstrapValidator.js

+ 32 - 0
dist/js/bootstrapValidator.js

@@ -521,6 +521,38 @@
             this.updateStatus(field, this.STATUS_NOT_VALIDATED, null);
             this.updateStatus(field, this.STATUS_NOT_VALIDATED, null);
 
 
             return this;
             return this;
+        },
+        
+         /**
+         * Add a new field validation
+         *
+         * @param {String} field The field name
+         * @param {Object} Map the field name with validator rules
+         * 
+         * @return {BootstrapValidator}
+         */
+        addField: function(field, properties) {
+
+            this.options.fields[field] = properties;                    	           
+            this._initField(field);
+            
+            return this;
+                    	            
+        },
+        
+        /**
+         * Remove a field validation
+         *
+         * @param {String} field The field name 
+         * 
+         * @return {BootstrapValidator}
+         */
+        removeField: function(field) {
+
+        	delete this.options.fields[field];
+            
+            return this;
+                    	            
         }
         }
     };
     };