Recent

Validating or Requiring fields on Nintex Forms

Using validation rules you can make a field required for specific conditions, or you can check to make sure the value entered into a field is what you are expecting.

This tutorial is divided into 3 sections below:

  • Making a field required all the time
  • Making a field only required conditionally
  • Checking the validity of a field value (ex. is Start Date greater than Today)

 

Making a field required all the time

If a field on a Nintex Form should always be required, that should be set on the List itself and not in the form (the form picks up the list settings). To make a field required all the time, go to the List, click on the List tab in the ribbon, and click on the List Settings option. Scroll down the list settings page to the Columns section and click on the Column name you want to make required. Select Yes for ‘Require that this column contains information:’ option.
Nintex-form-validation-rule-15-1

Click the OK button to save your changes. This will now make that column/field required when people are filling out or editing the form.

Making a field required conditionally

In this example we are going to make the Notes field required only if the form submitter selects “Poor” for the Rate your experience field. Basically if they say their experience was poor we want to make sure they include some additional notes so we know why.
1. Click on the field you want to make required, then click on the Add Rule icon.
Nintex-form-validation-rule-15-2
2. Add a descriptive name for the rule, choose Validation for the Rule Type, then click on the Formula icon.
Nintex-form-validation-rule-15-3

3. Add the Named Control, Property, or Variable that will determine if the field is required. In this case, click on the Common Controls tab and then click on the Rateyourexperience field. You should see your selection displayed in in the Formula box at the bottom of the Formula builder window.
Nintex-form-validation-rule-15-4
4. Add the condition which will make the field required. In this case I want the field required when their experience equals Poor (Please note that the value Poor is case sensitive). Then add two appersands (&&) to the end of your condition so we can also check if the required field is empty.
Nintex-form-validation-rule-15-5

**For additional Formula examples, see the Rule Formula Examples wiki article.
5. Click on the Runtime Function tab, double-click on isNullOrEmpty function. The isNullorEmpty function should then be displayed at the end of your formula.
Nintex-form-validation-rule-15-6
6. Click inside the isNullorEmpty Parenthesis, then click on the Named Controls tab, double-click the {Self} control. That should insert the {Self} control into the isNullOrEmpty function as displayed below in the formula box. The {Self} named control always references whichever field the Rule was added on in step 1.
Nintex-form-validation-rule-15-7
7. Click the OK button to save the formula builder. Back on the Rules pane, add a Message that will be displayed if the field should be required. Your completed rule should look something like this:
Nintex-form-validation-rule-15-8
Example: Trying to submit the form with Poor selected for the Rate your experience field, and the Notes field is empty, generates our validation rule message.
Nintex-form-validation-rule-15-9

 

Checking the validity of a field value

Using Validation rules you can also check the format or compare the values entered into a field to ensure the entered value is what you are expecting or need. Some examples would include; making a Start Date greater than today, making End Date greater or equals to Start Date, making a number or currency field greater than a certain value, or making an Email field have a valid email address in it.

In this example we are going to make the Start Date greater than or equal to the date is originally submitted. At the very bottom of this article is a link to more validation formula examples as well.

1. Click on the field you want to make required (e.g Start Date), then click on the Add Rule icon.
Nintex-Forms-Data-Validation-15-1
2. Add a descriptive name for the rule, choose Validation for the Rule Type, then click on the Formula icon.
Nintex-Forms-Data-Validation-15-2

3. Click on the Runtime Functions tab, then insert the desired function. In this example double-click on the greaterThanOrEqual runtime function, it should then be displayed in the Formula box at the bottom of the Formula builder window.
Nintex-Forms-Data-Validation-15-3
4. Click inside the ‘greaterThanOrEqual()’ parenthesis, click on the Common Tab, then click on field it needs to be greater than. In this example double-click on the Current Date field. Current Date should be inserted into the parenthesis in the Formula box like in the example below.
Nintex-Forms-Data-Validation-15-4
5. Add a comma and a space inside the parenthesis after the field, then click on the Named Controls tab, double-click on the {Self} value. This should insert the {Self} reference inside the parenthesis after the comma and space like shown below.
Nintex-Forms-Data-Validation-15-5

**{Self} references the field we are creating the rule on. So in this example, we are saying that Current Date must be Greater than or Equal to Self (i.e. Start Date).

6. Then add two appersands (&&) to the end of your condition so we can also check that this is rule only validates on new form submissions. We wouldn’t want it to also work when the form is edited, as the current date will change but the only thing we care about, is that the start date was greater than the current date when the form was first submitted.
Nintex-Forms-Data-Validation-15-6

7. Click on the Common tab, double-click on Is New Mode. That should insert the reference to the end of your formula.
Nintex-Forms-Data-Validation-15-7
8. Click the OK button to save the formula builder. Back on the Rules pane, add a Message that will be displayed if the field is not Valid. Your completed rule should look something like this:
Nintex-Forms-Data-Validation-15-8
Example: Trying to submit the form with Start Date less than the current date, generates our validation rule message.
Nintex-Forms-Data-Validation-15-9

For more examples to see how to format validation rules see the Rule Formula Examples wiki article.

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: