How can I restrict a text field to only allow so many numbers?

  • 29 October 2014
  • 8 replies
  • 92 views

Badge +2

I have some text fields that i need to be restricted to 4 or 10 numbers.   How can I accomplish this?


8 replies

Userlevel 5
Badge +12

On the text field configuration, under advanced section, you can set the Max Length field.    This will restrict the number of characters one can type, assuming you mean characters and not "numbers" specifically.

Thanks

Badge +2

This is all I see when I am in the text field settings.

Userlevel 5
Badge +12

Ok, that is because you have the text field "connected" to a column in the list.   In this case you need to go to List Settings, and click on the column name you want to set a max character limit for, and enter this number in the Max number of characters field in the list itself.  The Nintex form will respect the number you set here.

Thanks

Badge +9

You can use a validation with Regular expression:

^d{10,10}|d{4,4}$

Badge +2


You can use a validation with Regular expression:

Example if you only need 7 numbers to be entered in the field, double click on the field for settings.  Then Select Yes for "Use Regular Expression" and enter the expression  .{7}

Thx!

Badge +9

Dot matches any character. To match a digit you have to use d. See my previous answer and Regular Expression Language - Quick Reference .

Badge +2

In the event that you want numbers only, instead of a period ".", please use the following for 7 digits only... ^d{7}$

Badge +4

I have a requirement for exactly 9 characters with a single dot (.) and no spaces on start, end, or in between characters. For example: 1234a6.01

1234a6 = can be numbers or string only

. = must be a dot (.) exactly after 6 characters

01 = must be number only

I was able to with: ^[a-zA-Z0-9.S]{9,9}$

but i can still input alphabet after the dot (.), and insert dot anywhere.

Reply