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
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
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.
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
Dan, could you post a link to the max-length plugin you used? I'm sure others would find it useful.
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)
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/
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?
It's already on our to do list so it will make it into a future release.
You guys ... you're always ten steps ahead of me!
@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.
any dates on this type of update?
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.