Input field (Number)

How can i make the input field to accept only whole numbers. I use it as a quantity input field and i dont want the users to write a quantity with decimal numbers, only whole numbers.
Anyone have an idea? Ty :wink:

You can use ROUND or INT functions in a custom formula.

Add 2 input fields. We’ll call them Input 1 and Input 2.
The first input field is the user’s input field where they type. Doesn’t matter if they add a decimal here, we’re gonna get rid of it.

For Input 2, add magic text > “Custom Formula”.

Inside the formula, insert a ROUND or INT function (depending if you want the number to round up or down based on the decimal the user inputs) and then insert the “other component > input 1” and close the parentheses.

Round will round the decimal to the nearest whole number. For example: 1.1 will go to 1 and 1.5 will go to 2 and 1.9 will go to 2.

INT is integer and will remove the decimal completely. For example: 1.1 will go to 1 and 1.5 will go to 1 and 1.9 will go to 1.

Make the 2nd input invisible by removing the background and the border, and by setting the placeholder and text to 0% transparency.

On your button, set an action to perform whatever actions you want, and use “Input 2” as the magic text. This will remove the decimal point from Input 1’s value.

1 Like

Just to clarify - what’s the idea of adding 2nd input? You could simply update the required numeric property directly using Custom Formula…


You’re right @Victor. I tend to lean on inputs quite a bit.

1 Like

Thanks for the help!

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.