Configure Text Pattern-Based Validations In NITRO Forms

Applies To:
Crow Canyon NITRO activated sites in:
SharePoint Online and On-Premises 2013/2016/2019

Description

NITRO Forms column validation feature supports several built-in ways to ensure that entered column values follow the required rules. Predefined patterns include validating format for phone number, email, and number. For any custom patterns, regular expression can be used for validation. This article lists sample use cases for regular expression-based validations.

Use Case 1

Configure validation such that specified value in the single line of text column should not have space(s) at the end of line.

In this sample, validation is configured on ‘Employee Name’ column. This is a single line of text column; validation will also work on multiple lines of plain text column.

  1. Navigate to NITRO Forms designer settings.

Go to List -> List Settings -> Crow Canyon NITRO Forms -> Select the required column -> Expand ‘Validations’ section on the right -> Click ‘Add’ button to configure a new validation.

  1. Configure the column validation as shown below:

Note that validation type is ‘Pattern’ and pattern value is ‘Custom’. Regular expression used in ‘Validation Value’ is [^\s]+$

After configuring this validation, publish the NITRO Forms.

Sample output

Use Case 2

Configure validation such that the entered email address in single line of text column should be of a specific domain. Email addresses are validated on the bases of specific but case insensitive domain.

In this sample, validation is configured on ‘Email Address’ column. Only the first email address specified in this single line of text column is validated.

  1. Navigate to NITRO Forms designer for the list.

Go to the list -> List Settings -> Crow Canyon NITRO Forms -> Select the required column -> Expand ‘Validations’ section on the right -> Click ‘Add’ button to configure a new validation.

  1. Configure column validation as shown below:

Click ‘Edit’ button to specify custom script.

Script:

var reExpr = new RegExp(/((\w+).?)+@contoso\.com/i);
objData.Status = reExpr.test(objData.ColumnValue);
if(!objData.Status){
	objData.Message = "This domain is not allowed";
}
return objData;

Note:

  • Replace ‘contoso’ with required domain.
  • Replace ‘This domain is not allowed’ with required validation message.

After configuring this validation, publish the NITRO Forms.

Sample output

Use Case 3

Configure validation such that specified value in a column should not have any special characters.

  1. Navigate to NITRO Forms designer settings.

Go to List -> List Settings -> Crow Canyon NITRO Forms -> Select the required column -> Expand ‘Validations’ section on the right -> Click ‘Add’ button to configure a new validation.

  1. Configure the column validation as shown below:

Note that validation type is ‘Pattern’ and pattern value is ‘Custom’. Regular expression used in ‘Validation Value’ is ^[a-zA-Z0-9-\s]*$

Above regular expression allows alpha numeric characters, space and hyphen.

Regular expression can be modified as needed.

After configuring this validation, publish the NITRO Forms.

Sample output