Hi all. Really cant remember how to do this as don’t get involved very often with the custom function.
I have a form with an ID of 1 in which I would like the number field 1 to only accept whole numbers. At present when a form is submit you only have 9.999 or 9.000. This is for a mileage so I would like it to show only whole numbers.
So to cut down the long wined question
How do I target just form 1?
How do I target just field 1
How do I ensure the system makes the number field whole numbers both when typing and after submission.
If you don’t feel comfortable using custom code I would recommend you try the following alternative.
Use a Single Line Text field instead and create your own custom input mask using the field settings, you can find more details about custom input masks creation for this field type here: https://docs.gravityforms.com/input-mask/#h-custom-input-masks
For example, the following custom mask would require a value with one digit, no decimals:
9
If you want to allow a number that can have up to 4 digits, you would use:
I’m not uncomfortable with code as such. Was hoping some had a quick answer, invariably I would have hoped someone on here would have come across this. Plus I’m using the number field for a calculation. Would the text field have the ability for use in calculations?.
Sure, as long as the text field contains a valid number, there’s no problem in using the merge tag of a text field in a calculation formula. It will work exactly as it does with a number field.