The text box sets the constraint to a positive integer

Hello, my friends
Recently I had a problem with axure. I wanted to restrict the textbox to only positive integers. Although I know how to set it to a number, how do I set the limit to positive integers?

@Jane_Axure I hope you can help me with this problem

I think its sufficient to set the type of a textfield to ‘Number’. I guess you have already tried that?

If this isn’t your preferred solution you can readjust the value either onTextChange or onLostFocus using the Math.abs() Function

1 Like


There’s a trick in Axure where you can restrict text entry to any set of characters you choose. You create an OnKeyDown interaction testing for keys. Any keystrokes that cause the condition to return FALSE will be allowed in. So the following will only let in the numbers 0 through 9 (from either the top row or from the number pad) and other keystrokes you need when inside of a field, such as for copy/paste, moving around inside of the field, etc.

Here it is so you don’t have to create all of these conditions:

numbers_only_field (1).rp (57.9 KB)


Oh!Thank you very much Zuvala. Your solution solves my problem. Thank you

Oh!Thank you josephxbrick. The skills you Shared have enabled me to use them in many aspects of the project