Recent

Nintex Forms checking the format of fields

With forms you sometimes to need to check the format of fields to ensure they are formatted as you would expect them to be.  Some examples of formatted fields include:

  • Email Addresses
  • Social Security Number
  • A number that is xx digits long (e.g. NPI number is always 10 digits long)
  • Only letters and specific symbols allowed

To check the format of the data entered into a field you will need to use the Control Regular expression formula for that field.

To do that, double-click on the field to open the Control Settings for the field.  Click on the Validation + mark to expand the section, for Use a regular expression select Yes.  You can then enter a Regular expression (examples below) and a error message for that field.
nintex-forms-format-expression-16-1

Regular Expression Examples

Email Address format

^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$

Social Security Number format

\d{3,3}-\d{2,2}-\d{4,4}$

A 10 digit long number format

\d{10,10}$

Between a 7 and 9 digit long number format

\d{7,9}$

Alphanumeric (no special characters)

[0-9a-zA-Z\s]*

 

Phone Number with area code (allows either dashes or periods in between the numbers):

\b\d{3}[-.]?\d{3}[-.]?\d{4}\b

 

Creating your own Regular Expressions

I found a really useful site (http://www.regexr.com/) which I’ve found helpful to create and test regular expressions.

**Please note, do not use either the ^ or $ at the start or end of your expressions on the regexr site, these symbols should only be used on a single line of text field.  The test text on that site is in a multi-line text field so if you use either of those symbols you will get incorrect results.

Example of testing the email formating on RegExr:
nintex-forms-format-expression-16-2

 

 

 

 

About Nick Hurst (84 Articles)
SharePoint and Nintex developer who strives to find easy to deploy and maintain solutions for business problems.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: