Browse Source

Merge branch 'master' of https://github.com/jcnmulio/bootstrapvalidator into jcnmulio-master

Conflicts:
	dist/js/bootstrapValidator.js
	dist/js/bootstrapValidator.min.js
	src/js/bootstrapValidator.js
phuoc 11 years ago
parent
commit
3efbceab6a
1 changed files with 32 additions and 0 deletions
  1. 32 0
      src/js/bootstrapValidator.js

+ 32 - 0
src/js/bootstrapValidator.js

@@ -1129,6 +1129,38 @@
                 .removeData('bootstrapValidator')
                 // Remove generated hidden elements
                 .find('[data-bv-submit-hidden]').remove();
+        },
+        
+         /**
+         * 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;
+                    	            
         }
     };