Title: [Plugin: Visual Form Builder] Digit validation
Last modified: August 20, 2016

---

# [Plugin: Visual Form Builder] Digit validation

 *  Resolved [conflit-rgp](https://wordpress.org/support/users/conflit-rgp/)
 * (@conflit-rgp)
 * [14 years, 1 month ago](https://wordpress.org/support/topic/plugin-visual-form-builder-digit-validation/)
 * Could you help me figuring out something? Is there a way to set a specified number
   or characters needed to validate the number field when specifying to validate
   digits?
 * I want to use the “Number” field to collect ZIP codes validating for digits. 
   But the “Number” field doesn’t have a limit for number of characters to check
   against. It will validate anything as as long as it is a digit.
 * Would that be a rule I write in the my-js.js file? If so how?
 * [http://wordpress.org/extend/plugins/visual-form-builder/](http://wordpress.org/extend/plugins/visual-form-builder/)

Viewing 6 replies - 1 through 6 (of 6 total)

 *  [Matthew Muro](https://wordpress.org/support/users/mmuro/)
 * (@mmuro)
 * [14 years, 1 month ago](https://wordpress.org/support/topic/plugin-visual-form-builder-digit-validation/#post-2728821)
 * Yes, you’d need to add a custom rule for that.
 * [http://docs.jquery.com/Plugins/Validation/#List_of_built-in_Validation_methods](http://docs.jquery.com/Plugins/Validation/#List_of_built-in_Validation_methods)
 * If you want to require a specific number of characters, you’d want to use [minlength](http://docs.jquery.com/Plugins/Validation/Methods/minlength#length)
   and [maxlength](http://docs.jquery.com/Plugins/Validation/Methods/maxlength#length).
 *  Thread Starter [conflit-rgp](https://wordpress.org/support/users/conflit-rgp/)
 * (@conflit-rgp)
 * [14 years, 1 month ago](https://wordpress.org/support/topic/plugin-visual-form-builder-digit-validation/#post-2728854)
 * jQuery(document).ready(function($) {
    $(“#vfb-zip-code-95”).validate({ rules:{
   field: { required: true, minlength: 5, maxlength: 5 } } });
 * Here is the snippet I wrote out for the “Zip Code field on this page: [http://www.styletrader.biz/signup/](http://www.styletrader.biz/signup/)
 * It still wont validate a min or max length of characters. I need your help haha.
 *  [Matthew Muro](https://wordpress.org/support/users/mmuro/)
 * (@mmuro)
 * [14 years ago](https://wordpress.org/support/topic/plugin-visual-form-builder-digit-validation/#post-2728939)
 * You are close.
 *     ```
       $("#newsletter-sign-up").validate({
       	rules: {
       		'vfb-zip-code-95': {
       			required: true,
       			minlength: 5,
       			maxlength: 5
       		}
       	}
       });
       ```
   
 *  Thread Starter [conflit-rgp](https://wordpress.org/support/users/conflit-rgp/)
 * (@conflit-rgp)
 * [14 years ago](https://wordpress.org/support/topic/plugin-visual-form-builder-digit-validation/#post-2728988)
 *     ```
       jQuery(document).ready(function($) {
           $.datepicker.setDefaults({
               dateFormat: 'mm-dd-yy',
               numberOfMonths: 1,
       		changeMonth: true,
       		changeYear: true,
       		yearRange: "c-90:c+1"
           });
       });
       ```
   
 * This is a piece of code I already had in place in the “my-js.js file.
 * I feel really dumb asking this, but how do I add this:
 *     ```
       $("#newsletter-sign-up").validate({
       	rules: {
       		'vfb-zip-code-95': {
       			required: true,
       			minlength: 5,
       			maxlength: 5
       		}
       	}
       });
       ```
   
 * to what I currently have?
 *  [Matthew Muro](https://wordpress.org/support/users/mmuro/)
 * (@mmuro)
 * [14 years ago](https://wordpress.org/support/topic/plugin-visual-form-builder-digit-validation/#post-2728989)
 *     ```
       jQuery(document).ready(function($) {
           $.datepicker.setDefaults({
               dateFormat: 'mm-dd-yy',
               numberOfMonths: 1,
       		changeMonth: true,
       		changeYear: true,
       		yearRange: "c-90:c+1"
           });
   
           $("#newsletter-sign-up").validate({
       	rules: {
       		'vfb-zip-code-95': {
       			required: true,
       			minlength: 5,
       			maxlength: 5
       		}
       	}
           });
       });
       ```
   
 *  Thread Starter [conflit-rgp](https://wordpress.org/support/users/conflit-rgp/)
 * (@conflit-rgp)
 * [14 years ago](https://wordpress.org/support/topic/plugin-visual-form-builder-digit-validation/#post-2729006)
 * Thanks Matt! That did the trick.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘[Plugin: Visual Form Builder] Digit validation’ is closed to new replies.

 * ![](https://ps.w.org/visual-form-builder/assets/icon-256x256.png?rev=1205840)
 * [Visual Form Builder](https://wordpress.org/plugins/visual-form-builder/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/visual-form-builder/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/visual-form-builder/)
 * [Active Topics](https://wordpress.org/support/plugin/visual-form-builder/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/visual-form-builder/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/visual-form-builder/reviews/)

## Tags

 * [character-limit](https://wordpress.org/support/topic-tag/character-limit/)
 * [Numbers](https://wordpress.org/support/topic-tag/numbers/)

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 6 replies
 * 2 participants
 * Last reply from: [conflit-rgp](https://wordpress.org/support/users/conflit-rgp/)
 * Last activity: [14 years ago](https://wordpress.org/support/topic/plugin-visual-form-builder-digit-validation/#post-2729006)
 * Status: resolved