Using validation rules to ensure a comments box is not left empty

Document created by emily.billing@nintex.com Champion on Jul 1, 2014Last modified by emily.billing@nintex.com Champion on Feb 8, 2016
Version 12Show Document
  • View in full screen mode

The Scenario: When a task is rejected, ensure the user cannot submit before including a comment.

 

Crestan, a business management company has discovered an issue during their annual business systems audit. Approval tasks for system documentation have been completed and marked as rejected by some managers and employees without feedback or a given reason. The General Manager has asked you to modify the form so if a task is rejected, the user must fill in the comments field.

 

This scenario is only applicable to the Request Approval workflow action, and is applicable to both Nintex Forms 2013 and Nintex Forms 2010.

 

Validation Rules were introduced in Nintex Forms released on 5th June 2014.

Nintex Forms 2013 v2.3.2.0

Nintex Forms 2010 v1.5.2.0

 

Requirements

  • A user must be forced to enter a comment if they reject a task
  • The comment cannot be a blank value or whitespace

 

Outcome

The comments box will display a red border and a message will display if the task was rejected and comments have not been entered.

 

Configure the Nintex Task Form

For the purpose of this example, we will modify the Nintex task form within a Nintex Workflow 2013 Request Approval Action.

 

  1. In the Workflow Actions toolbox, select the User Interaction toolbox.
  2. Drag a Request Approval action onto the design canvas.
  3. Double- click to open the dialog box. In the Ribbon, click on the Edit Task Form and select Edit with Nintex Forms.

task form.png

Add a Rule

Select the Comments text box of the task form so we can add a rule to this control and click Add Rule in the Ribbon.

comments.png

formatting.png

 

Give the rule a Name “Not empty when”, and select the Rule Type as Validation.

 

In the Condition field, click on the Formula Builder icon. Select the Runtime Function “isNullOrEmpty”, and in the () select the Named Control, {Self}. This means “if the control on which this is running is null or empty…”

 

isNullOrEmpty({Self})

 

Next we add another condition to the formula when the outcome is rejected. Add “&&” and then in the Named Control tab, select Decision. The value for reject is 2, and for approve 1, so need to add ==”2”.

 

To find this value, you need to publish the workflow, then run it and use the F12 developer tools of your browser to find the values on those radio buttons.  If you check this value using F12 developer tools in the Nintex Forms preview, you will see both show as -1 values, this is incorrect when published and should be Reject=2 Approve=1.

 

The final formula should look like this, and means “this control is invalid if this field is empty and the outcome is rejected”.

 

isNullOrEmpty({Self}) && Decision=="2"

 

In the Message field, enter a message for when the form cannot be submitted.

 

 

 

 

 

 

Save the form. Now, when a user rejects a task, and tries to submit without providing a comment, a red line will appear around the comments section, and the message will appear at the top of the form.

form.png

For more examples:

Validation Rules and the People control - Nintex Forms

How to complete Date Validation using Nintex Forms 2013 Validation Rules

Formatting vs Validation Rules in Nintex Forms

3 people found this helpful

Attachments

    Outcomes