Nintex form rules + validation examples

In this Nintex forms tutorial, we will discuss Nintex form rules and validations with a few examples.

  • Nintex form rules for mandatory field validation
  • Nintex forms Regular Expression Validation (allow only letters)
  • Nintex form Phone Number Validation
  • Nintex form E-mail Validation using Rules
  • Nintex forms rule dropdown
  • Nintex form rule checkbox
  • Nintex form show hide button
  • Rules for checkbox in Nintex forms
  • Set field value in Nintex forms using JavaScript

Implement validation by rules in Nintex forms

Let us see, we will discuss how to implement validation rules by the condition in Nintex forms for Office 365 SharePoint online. We can implement validation rules very easily by using various functions, fields, etc which are available in Nintex forms for Office 365.

In this example, I have a drop-down list in the SharePoint list form which has two options: Approve and Reject.

My requirement is if the user selects the Approve button then there should not be a validation. But if the user select the Reject option, the user has to put some comment for rejection in a multiline textbox.

Implement Validation Rules by Condition in Nintex Forms for Office 365 SharePoint Online

First Open your SharePoint Online site and the go to the particular Sharepoint list. From the list ribbon, click on the Nintex Forms option which will open Nintex form designer.

Then In the Nintex form designer, Drag and drop a Choice control from Forms Controls toolbox. Then double-click on the Choice box to open the Settings dialog box.

Here give a name for the choice control.

Then select the display format, I want this to appear as a drop-down list, so I selected the Dropdown list option. Then put the values, here I want only two options to Approve and Reject. So add Approve, Reject (separate by comma). The settings will look like below:

nintex forms required field validation
nintex forms required field validation

Then drag and drop a Panel control to the form and double-click on the Panel to open the Control Settings dialog box. Here give a name and Title put some meaningful message which will appear in the panel. It looks like below:

nintex forms mandatory field validation
Validation rules in Nintex forms SharePoint Online

Now drag a multiline textbox inside to the panel. Double click on the Multiline textbox to open settings dialog box. Give a name form the multiline textbox and then Save.

Now it is time to add our rules to the control.

Select the Panel control and then from ribbon click on Add Rule button. Once it will open give a name for the rule and then select Rule Type as Formatting.

Then in the Condition box, click on the fx button. Here we will write a rule to show the comment box when the user selects the Reject button.

Here select from Named Controls select the drop-down list name, then from the Operators select the “!=” operator. Then write “Reject”.

So the rule should be: choiceApproveReject !=”Reject”. Then in the Formatting option, choose the Hide option. The rule should look like below:

So the rule is like:

txtRejectComments =="" && choiceApproveReject=="Reject"

And type validation message as “Please enter rejected comment.”

So the rule should look like below:

nintex forms validation rules examples
nintex forms validation rules examples

Now publish the form and then try to create a list item as shown in the fig below: If you select Reject option and then try to submit it will display the error message as shown in the fig below:

nintex forms validation rules examples
nintex forms validation rules examples

This is how to implement validation rules by a condition in Nintex forms for Office 365 SharePoint Online.

Read: Nintex workflow examples

Nintex form rules for mandatory field validation

Let us see, how to implement mandatory field or required field validation using rules in Nintex forms for Office 365. Sometimes, you may need to implement require field validations using Nintex forms in the SharePoint Online list or libraries.

In this example, there is a SharePoint Online list name as “BlogsLists” and it has two columns known as:

  • Title
  • Blog name

Here I want to make the Blog name field as a required or mandatory field using rules in Nintex forms.

First Open the list in the browser and then click on Nintex Forms from the ribbon-like below to customize the form using Nintex Forms for Office 365.

nintex forms required field validation
nintex forms required field validation

Then in the Nintex Form for Office 365 designer, select the blog name textbox and from the Ribbon click on Add Rule button like below:

Nintex forms for Office 365 textbox validation
Nintex forms for Office 365 textbox validation

Then in the Rule give a meaningful name for the Rule and then select the rule type as Validation from the drop-down.

Then in the Condition click on fx button like below:

Nintex forms implement mandatory validation rules
Nintex forms implement mandatory validation

Then in the Formula Builder, from the INSERT REFERENCE, expand Runtime Functions and double click on isNullOrEmpty function. Then in the isNullOrEmpty function select value and expand Named Controls and from there double click {Self} and the formula should look like below:

Nintex forms mandatory field validation
Nintex forms mandatory field validation

Then in the message, type the message which you want to show it to the user. And overall the rule looks like below:

nintex forms validation rules examples
nintex forms validation rules examples

Now publish the form and open the list to add one item to the SharePoint Online list.

Now when you will try to add one item to the list and without giving any value when you will try to save the item, it will display validation message like below:

nintex forms validation rules examples
Required field validation in Nintex form for office 365 using Rules

Now if you put an entry in the blog name and click on Save, it will now show any validation message for blog name field.

nintex forms validation rules examples
nintex forms validation rules examples

This is how to implement mandatory field validation using rules in Nintex forms for Office 365 in SharePoint Online list.

Nintex forms Regular Expression Validation (allow only letters)

I hope you already have a SharePoint Online having some fields in it.

Right-click on the “Textbox” control, then click on “Settings“. it will open “Control Settings – Single Line Textbox”.

Go to the Validation section, here select “Use a regular expression” as “Yes“, enter the Regular expression and Regular expression error message as shown below.

For enter only letters in textbox control add Regular Expression like “[a-zA-Z]+ ” .

Numerical and Alpha Field Validation nintex form
Numerical and Alpha Field Validation nintex form

This is how to implement regular expression validation in Nintex forms for Office 365 SharePoint Online.

Nintex form Phone Number Validation

Now, let us see, how to implement phone number validation using Nintex form rules.

Add Rule Validation: Open the list form using the Nintex form for Office 365 designer and follow the same steps as we discussed above for the validation. Add Condition like ” isNullOrEmpty({Self}) ” or ” isNullOrEmpty(PhoneNumber) ” in Nintex forms in SharePoint Online.

Regular Expression Validation: Open the SharePoint list form using the Nintex form for Office 365 designer and follow the same steps as we discussed above for the validation.

For enter only digits in textbox control add Regular Expression like ”
\d{10,10}$ ” .

Numerical and Alpha Field Validation nintex form
Numerical and Alpha Field Validation nintex form

This is how to implement digit only validation using rules in Nintex forms for Office 365.

Nintex form E-mail Validation using Rules

Now, let us see how to implement Nintex forms email validation using rules in Share

Add Rule Validation: Open the list form using the Nintex form for Office 365 designer and follow the same steps as we discussed above for the validation. Add Condition like “isNullOrEmpty({Self})” or “isNullOrEmpty(E-mail)“.

Regular Expression Validation: Open the list form using the Nintex form for Office 365 designer and follow the same steps as we discussed above for the validation. 

For E-mail validation add Regular Expression like:

(?:[a-z0-9!#$%&'*+/=?^_{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?\.)+[a-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])
Numerical and Alpha Field Validation Nintex form
Numerical and Alpha Field Validation Nintex form

After Save and Publish the form go to your list and click “new item” and click on the save button without enter details, errors will be shown for all the fields as shown below.

nintex form validation
nintex form validation

Check the fields one by one name and Phone Number and E-mail fields. you will get an error message when you enter numbers in the “Name field” and when you enter text in the “Number field” and When you wrongly enter an email address(Enter small letters only else you will get an error) in the “E-mail field“. Follow the below screenshot.

Numerical and Alpha Field Validation nintex form
Numerical and Alpha Field Validation nintex form

This is how to implement email id validation using Nintex forms for Office 365 and SharePoint Online.

Nintex forms rule dropdown

Let us see, how to make a field mandatory based on Choice field value in Nintex forms for office 365.

Here, we will make a Description filed mandatory when the selected value of the Status dropdown list equal to “Closed“. Let us see how to make Nintex forms a mandatory field based on the dropdown list selected value.

In this Nintex form example, I have an IT Request form in SharePoint Online for Office 365. In the form, I have taken a dropdown list that has few values like Open, Assigned, InProgress, and Closed. 

My requirement here is, if a user selects the Closed option from the drop-down list, then the user has to put a description mandatorily. For other options, putting a description is not mandatory. We will discuss here how to achieve this using Rules in Nintex Forms for Office 365 SharePoint Online.

Step 1: Create a list and go to your list tab, click on “Nintex forms“. you will get Nintex designer view as shown below.

validation is based on choice nintex forms
validation is based on choice nintex forms

Step 2:  Click on “Multiple line Text-box “, go to the Control tab and click on “Add Rule“. Then RULES panel will be appeared right side of the Nintex form.

how to make a field required is based on choice nintex forms
how to make a field required is based on choice nintex forms
  • Enter Name for the control.
  • Select Rule Type as a “Validation” from the drop-down.
  • In Condition, add the rule “equals(Status, ‘Closed’)“. Use this rule on the field you want to be validated.
  • In the Message box, enter the validation error as shown above.

Step 3:  If you have chosen Status “Closed” from the dropdown it will make that field is required as shown below.

how to make a field required in nintex forms
how to make a field required in nintex forms

Add Validation for Drop-down List in Nintex Forms

Now I will show you, how we can validate a drop-down list in Nintex Forms for Office 365. We will validate for mandatory validation for the dropdown list in Nintex Forms.

Step 1: Click on drop-down control -> go to Control tab -> Click on Add Rule button. Enter the details as shown below. In Condition section , add a rule for drop-down checking empty or not  “(isNullOrEmpty({Self}))“. Use this rule on the field you want to be validated.

nintex form required field
nintex form required field

Step 2: You will get an error message when you click on the submit button without selecting Status from the drop-down as shown below.

validation is based on choice nintex forms
validation is based on choice nintex forms

This is how to do dropdown validation in Nintex forms for Office 365.

Nintex form rule checkbox

Let us see, how to show or hide fields on multiple choices checkbox in SharePoint Online list form using Nintex forms for Office 365.

I would like to show this functionality in a simple SharePoint Online list form which is customized using Nintex forms for Office 365.

Sometimes we require showing or hiding a field control based on selected one from multiple checkboxes in Ninex form.

In this article, we will see how easily we can show or hide fields on a multiple-choice checkbox, the same functionality using rules in Nintex forms for Office 365 SharePoint Online.

Step 1: First Open your SharePoint Online site and go to the SharePoint list form in which you want to add the rule. On your SharePoint list ribbon, click on Nintex Forms as shown below.

Show or hide controls with Rules in Nintex Forms
Show or hide controls with Rules in Nintex Forms

Step 2: You will get the Nintex Forms Designer View (select classic form), here you will place the field control related to the chosen field as shown below.

Show Or Hide Fields Using Rule In Nintex Forms
Show Or Hide Fields Using Rule In Nintex Forms

Here in this particular Nintex Forms, I have multiple checkbox columns as “Medical Leave Reason” which has below 3 values:

  • Birth of my child
  • Adoption Placement
  • Other

Here my requirement is when a user checks the “Birth of my child” option, it should open a Date picker where a user can enter the birth date.

Step 3:  Hide/Show the “BirthofchildDate” date field Control in Nintex Forms.

Click on the “BirthofchildDate” field, Go to the control tab on the ribbon bar and click on the “Add Rule” button, the below rule bar will open as shown below.

Hide/Show on multiple choices checkbox
Hide/Show on multiple choices checkbox
  • On the bar click on  “Add” button and configure your rule 
  • Enter Name: provide a name for the rule, Rule Type: In our case select Formatting from the drop-down list and Condition: add Rule ”
    not(inArray(MedicalLeaveReason,’Birth of my Child’)) “.
  • we have checked in the “Hide” checkbox so our field is hidden unless the condition is valid.
  • Here choice fields are in an array (MedicalLeaveReason), so we have taken “not” and “inArray()” from Runtime function in formula builder(f(x)). When you click on ‘Birth of my Child’ of checkbox then only a particular date field will have appeared.

Step 4: We will Hide Rest of Two Choice field control when you check the first Checkbox(“Birth of my Child”) follow the below steps.

Hide the  “AdoptionPlacementDate” field:

  • Click on “AdoptionPlacementDate” field control, Click on “Add Rule ” button and enter the details as shown below.
  • For Hiding the “AdoptionPlacementDate” when “Birth of my Child” is checked.
  • Condition: ” inArray(MedicalLeaveReason,’Birth of my Child’) “.
  •  checked in “Hide” checkbox as shown below.
hide/show fields by on multiple checkbox nintex forms
hide/show fields by on multiple checkbox nintex forms

Hide the  “Other” field:

  • Click on “Other” field control, Click on “Add Rule” button and enter the details as shown below.
  • Hide the “Other” when “Birth of my Child” is checked.
  • Condition: ” inArray(MedicalLeaveReason,’Birth of my Child’) “.
  • Checked in “Hide” checkbox as shown below.
nintex forms rules yes/no
nintex forms rules yes/no

Step 5:  Follow the same steps from” Step 3 “and “Step 4” for other Two CheckBoxes(“Adoption placement” and “Other”).

Step 6: Save and Publish Form and see the below screenshot. After published form no date control and textbox control not displayed in the form.

show/hide control based on click on choice button nintex forms
show/hide control based on click on choice button nintex forms

Step 7: Rest of two checkboxes date controls not shown in the form when you click on “Birth of my Child” checkbox as shown below.

Hide or Show on multiple choices checkbox Nintex forms
Hide or Show on multiple choices checkbox Nintex forms

Step 8:   “BirthofchildDate” control is hidden When you click on other Checkboxes. See the below screenshot.

Show Or Hide Fields Using Rule In Nintex Forms
Show Or Hide Fields Using Rule In Nintex Forms

Step 9:  “BirthofchildDate” control date is shown when you unchecked the “Adoption Placement” checkbox as shown below.

Show or hide controls with Rules in Nintex Forms
Show or hide controls with Rules in Nintex Forms

Step 10: Anyone Checkbox only you can select and enter the date in date field control. Then the data will be added to your list as shown below.

Hide/Show on multiple choices checkbox
Hide/Show on multiple choices checkbox

This is an example of Nintex forms validation rules checkbox.

Nintex form show hide button

Let us check an example of the Nintex form show hide button or the Nintex form show hide based on checkbox.

In this example, we will see, how to enable or disable the Save button based on the checkbox (choice field) in SharePoint Online list form in Nintex forms.

Here I have a requirement to enable or disable Save button based on a checkbox, check or uncheck value in SharePoint online list form customized in Nintex Forms for Office 365.

Sometimes we need to enable or disable buttons based on a Yes/No field or a checkbox in Nintex forms.

I have a very simple list form in SharePoint Online which is customized using Nintex Forms for Office 365.

My requirement here is, unless the user checks the checkbox, the Save button should not be enabled. Before submitting the list form, the user needs to check the checkbox in Nintex Forms.

Step 1: Open your SharePoint Online site and then go to your list/library and from ribbon, click on Nintex forms.

nintex forms disable save button
nintex forms enable or disable

Step 2: The list will open in Nintex designer as shown in fig below.

nintex forms disable save button
nintex forms disable save button

Step 3: Here I am going to add a checkbox first in the Nintex Form. Drag and Drop the checkbox (yes/no) control on the form and take label control and place it inside the checkbox control as shown below.

Enable and Disable Buttons Conditionally in nintex forms
Enable and Disable Buttons Conditionally in nintex forms

Step 4: Click on Save button, next go to Control tab->click on Add Rule. it was opened right side of the form,  enter Name, Rule Type and Condition as shown below. Here in Condition, I marked with the green color line under the “CheckBox” name. It was the name of the checkbox control. For disabling button/field you can use this condition ” not(boolean) “

Enable Or Disable Fields Using Rule In Nintex Forms On Office 365
Enable Or Disable Fields Using Rule In Nintex Forms On Office 365

Step 5: Now save and Publish the Nintex form to SharePoint Online. Here you can see Save button is in disable mode because the checkbox is not checked yet.

nintex forms enable or disable
nintex forms enable or disable

Step 6: “Save” button will ” Enable” when you checked the checkbox as shown below.

Enable and Disable Buttons Conditionally in nintex forms
Enable and Disable Buttons Conditionally in nintex forms

This is how to enable or disable Save button, based on the checkbox checked or unchecked value in Nintex Forms for Office 365 SharePoint Online.

Rules for checkbox in Nintex forms

Let us see, how to apply rules for the checkbox in Nintex forms for Office 365 SharePoint Online.

Here I have a checkbox in Nintex Forms, and when a user checks the checkbox, then a comment box will open. If the user unchecks the checkbox, then the multiline textbox will be hidden in the Nintex forms.

In this particular example, I have customized a SharePoint Online list form using Nintex Forms for Office 365. To do this, Open SharePoint Online list and from Ribbon click on Nintex Forms like below:

nintex forms add rules
nintex forms add rules

This will open the Nintex forms designer and your Nintex form will open. Here I have taken a checkbox and based on checkbox checked or unchecked I am showing or hiding a section. So I have drag and drop a checkbox from General controls.

Then double-click on the checkbox control to change few properties of the control. Here I have given a Name and Text as “Do you want to give a comment?” this will appear after the checkbox. So the properties will appear like below:

nintex forms for office 365
nintex forms for office 365

Then I drag and drop a Panel control to the form. Now Inside the panel control, I have drag and drop a single line of a textbox. Here the UI should look like below:

nintex forms checkbox rule
nintex forms checkbox rule

And the requirement is If the user checked the checkbox then the panel should appear and if a user unchecks the checkbox the panel should get hide. Here we will write the rule on the panel control. Just select the panel control and from Ribbon click on Add Rule button as shown in the fig below:

nintex forms rules checkbox
nintex forms rules checkbox

Then the Rule builder will open, give a name for the rule. Select the Rule Type as Formatting. The click on the fx icon to write the condition. This will open the Formula Builder. Here expand the Named Controls and select comment which is our checkbox name. The expand the Operators and choose != and write true. It should look like below:

nintex forms validation rules checkbox
nintex forms validation rules checkbox

And then in the Formatting section choose “Hide” checkbox. So as per the formula if the checked box is not true (not selected), then it will hide the control. Your rules should look like below:

nintex forms validation rules
nintex forms validation rules

Now to try out this Publish the form and then Open the form and then check/uncheck the checkbox you will be able to see the result.

nintex forms add rules
nintex forms add rules

This is how to apply rules for checkbox in Nintex forms for Office 365 SharePoint online.

Set field value in Nintex forms using JavaScript

Let us see, how to use set field value in Nintex Forms for Office 365 in SharePoint Online using JavaScript. In this particular example, I have SharePoint online list which has Title, first name, and LastName column. Once the user puts some value in the FirstName then it should set LastName as FirstName.

Set field value in Nintex forms using JavaScript

Follow below steps to achieve these things.

Open the SharePoint Online List and then from the ribbon click on Nintex Forms button in the ribbon to open the Nintex form designer.

Nintex forms for Office 365 set field value
Nintex forms for Office 365 set field value

This will open the Nintex Forms for Office 365 designer and the list fields will appear.

Here first we need to set a JavaScript variable to the fields.

Double click on the first name textbox which will open the Control Settings dialog box. Here expand the Advanced section and first, select “Store Client ID in JavaScript variableYes and then give a variable name in the “Client ID JavaScript variable name” textbox. Here I have given the name as varFirstName.

nintex forms custom javascript set field value
nintex forms custom javascript set field value

Similarly, double-click on the LastName textbox and do the above step. The LastName looks like below:

set field value in nintex forms
Nintex forms how to set field value using javascript

Now we will write the JavaScript function which will set the field value. From the designer click on Form Settings.

nintex forms set field value javascript
Nintext forms office 365 set field value using javascript

Then in the Forms Settings dialog box, expand Custom JavaScript and put the below JavaScript code.

NWF$(document).ready(function(){
NWF$("#"+varFirstName).change(function()
{
var selectedValue = NWF$("#" + varFirstName).val();
NWF$("#"+varLastName).val(selectedValue);
});
});

It should look like below:

nintex forms set field value
How to use set field value in Nintex Forms for Office 365 in SharePoint Online?

Now Save and Publish the Nintex form. And once the form published successfully.

Now try to add one item to the list. In the form, if you will put something in the FirstName text box and once you come out of the textbox LastName textbox will auto-populate like below:

nintex forms set default value javascript
nintex forms set default value javascript

This is how to set field value in Nintex forms using JavaScript in SharePoint Online Office 365.

In this tutorial, we learned about, nintex form rules.

  • Nintex form rules for mandatory field validation
  • Nintex forms Regular Expression Validation (allow only letters)
  • Nintex form Phone Number Validation
  • Nintex form E-mail Validation using Rules
  • Nintex forms rule dropdown
  • Nintex form rule checkbox
  • Nintex form show hide button
  • Rules for checkbox in Nintex forms
  • Set field value in Nintex forms using JavaScript
>