In this post we will discuss how we can implement validation rules by condition in Nintex forms for Office 365 SharePoint online. We can implemt rules very easily by using various functions, field etc which are available in Nintex forms. If you are starting with Nintex forms then you can read: Working with Nintex Forms for Office 365.
In this example I have a dropdownlist which has two option: Approve and Reject. My requirement is if user select Approve button then there should not be a validation. But if user select Reject option, then user has to put some comment for rejection in a multiline textbox.
Also you can read:
– Create List Definition and List Instance in SharePoint 2013 using Visual Studio 2013
– Create SharePoint 2013 group using Rest API and Update SharePoint Group Details using Rest API
– Add Like and Ratings to Discussion Board in SharePoint 2013
Follow below steps:
First Open your SharePoint online site and the open the particular list. From the list ribbon click on 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 Settings dialog box. Here give a name for the choice control. Then select the display format, I want this to appear as a dropdownlist, so I selected Drop down list option. Then put the values, here I want only two options Approve and Reject. So add Approve,Reject (separate by comma). The settings will look like below:
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:
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 fx button. Here we will write a rule to show the comment box when user select the Reject button. Here select from Named Controls select the dropdownlist 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 be 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:
Now publish the form and then try to create a list item as shown in the fig below: If you slect Reject option and then try to submit it will display error message as shown in the fig below:
Hope this will be helpful.