PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Number field - exact number of digits

  1. Hi
    I have a number field in my form and I would like my users to enter a number with exactly 9 digits.
    Is there an option for that?

    Thanks
    Dan

    Posted 14 years ago on Tuesday July 6, 2010 | Permalink
  2. Currently you can't set how many digits the number in the Number field should be. You can only set a value range.

    I guess you could use the value range to limit the value so that the minimum and maximum were the lower end and the top end of the 9 digit value.

    Minimum
    100000000
    Maximum
    999999999

    But that would mean they couldn't use a 0 in the first digit. So it isn't perfect.

    Posted 14 years ago on Tuesday July 6, 2010 | Permalink
  3. Thanks Carl,
    what I ended up doing was setting a max limit via jquery (max length plug in) on the input field (stopping the user after entering 9 digits), and using the value range.

    Dan

    Posted 14 years ago on Wednesday July 7, 2010 | Permalink
  4. Dan, could you post a link to the max-length plugin you used? I'm sure others would find it useful.

    Posted 14 years ago on Wednesday July 7, 2010 | Permalink
  5. Alex
    Member

    Yes, I would love to know how to do this. I want people to enter a phone number but as we are UK based we can only use the international option giving us no validation.

    I want to set a number field so it is exactly 11 fields, giving the description to enter the phone number as 01234567890. This max lengrth plugin sounds like the option for me (but still need 0 as the first character)

    Posted 14 years ago on Monday July 19, 2010 | Permalink
  6. This one looks promising.. set it up then you can apply a custom class to any field to limit the length.

    http://andreaslagerkvist.com/jquery/max-length-form-controls/

    Posted 14 years ago on Monday July 19, 2010 | Permalink
  7. Surely this is an obvious feature to include in Gravity Forms?

    I stumbled across this old post because I was searching for a way to validate that users were correctly submitting 16-digit credit card numbers.

    I had already thought of Carl's suggested solution of creating a min and max range but the resulting "Please enter a value between 1000000000000000 and 9999999999999999" message beneath the field looks kludgey as Hell and will, I believe, confuse users.

    I will try the suggested JQuery plugin but surely this is a common enough need to be baked in as a feature?

    Posted 13 years ago on Sunday May 15, 2011 | Permalink
  8. It's already on our to do list so it will make it into a future release.

    Posted 13 years ago on Monday May 16, 2011 | Permalink
  9. You guys ... you're always ten steps ahead of me!

    Posted 13 years ago on Monday May 16, 2011 | Permalink
  10. @donnacha What we are planning on doing is actually not enhancing the Number field. There are issues with doing so.

    What we are going to be doing is adding built in validation options to the Single Line Text field which will allow you to use it for numeric values, etc. by selecting that type of validation. It already has the max characters feature so it already has that covered.

    The problem with adding this to the Number field is in HTML5 the Number field gets automatically formatted by the browsers that support HTML5 because it uses input=number as the input type. This means the browser turns 1000 into 1,000 and 100000 into 100,000 automatically. So this means it can't be used for things like credit card numbers, etc.

    So we will be enhancing the Single Line Text field to support a variety of pre-defined validation types that will allow it to be used for a variety of things, not just standard text input. It's more of just a catch-all input field.

    Posted 13 years ago on Monday May 16, 2011 | Permalink
  11. juzzfranks
    Member

    any dates on this type of update?

    Posted 12 years ago on Tuesday December 6, 2011 | Permalink
  12. Use the input mask capabilities of the Single Input field in Gravity Forms v1.6+ to create your own custom input mask to have them enter 9 numeric digits. You can use pre-defined masks or create your own using the built in tools and instructions. It's an option on the Single Input field.

    Posted 12 years ago on Tuesday December 6, 2011 | Permalink

This topic has been resolved and has been closed to new replies.