How to enforce numeric entry

Applies to Infiniti v8.7 or later

 

Keeping leading zeros in a number text field

When setting a text field’s data type to ‘Number’, the data entered is treated as a numeric value, resulting in all leading zeros be stripped out of the field.

This may not be desirable when creating postcodes and serial numbers etc...

To avoid this issue, we can use a combination of the Text data type (which retains all data entered) and a Regular Expression validation.

•Create a Text Field and change the Data Type to Text

•In Validation, change the Type to Regular Expression, and ensure that the Comparison is set to Match.

 


 

•Type [0-9] into the Expression

•Enter a message to be shown to the user if the validation fails. Click Add

This expression only allows characters between 0 and 9 to be accepted into the text field.

Further information on Regular Expressions can be found at https://regex101.com

 

Related Articles

Text field question type

Design: validating a project

 

Keywords

truncate