How do I validate a number pattern in a Form ?

  • 24 August 2015
  • 2 replies
  • 11 views

Badge +4

Hi,

 

I need to validate a response in a Form - to make sure it meets the pattern xxxx.xxx.xxxxxx

 

I think I need to use a Regular Expression but cant figure out what it needs to be.

 

Thanks,

Lexie


2 replies

Badge +6

Hi Lexie,

To only  set the display format,you can find the answer on thread of the forum  :Can i format the number type in Nintex Forms seperate by ","

 

If you want to create a real validation you have to set the Regular expression in the validation part of your field, and set the error message associated. For your case, it's not really complicated. I just tested it :  [0-9]{4}.[0-9]{3}.[0-9]{4} (i tried several cases, it seems to work)

 

formaterror.JPG

 

If you don't meet the correct format , it will prompt you an error .

Good luck

Badge +8

I have a similar question so I'll tack it on to this one.  I have a currency field that stores $0 if the user forgets the dollar sign so I want to use a regex to force the input of that character at the beginning of the string.  I've tried ^$ and ^[$], both of which work as expected in a regex tester (such as RegExr: Learn, Build, & Test RegEx ) but I still fail validation when I enter, say, $500.

This seems like a pretty simple case but it's not working. I even changed the column from currency to single line of text in case it was SharePoint rejecting the entry.

What am I doing wrong?

Thanks,

Bruce

Reply