zach.puckett

How to complete Date Validation using Nintex Forms 2013 Validation Rules.

Blog Post created by zach.puckett Support on Oct 22, 2014

Thanks to Sean Fiene for assistance.

 

Below is an example of how to perform Validation on specific controls based on their dates.

 

The goal: If start date is less than or equal to 11 days from today and\or If start data is more than 7 days before end date than prevent the form from being submitted.

 

Step 1:

Create a list with a “Start Date” and “End Date” column of data type “Date and time”.

 

Step 2:

  • Open Nintex Forms and choose “Forms Variables” from the ribbon bar.
  • I named my variable ‘varStartDate”
    • Type: Integer
    • Connected To: Not Connected
    • Recalculate formula on view mode: No
    • Recalculate formula on new mode: Yes
    • Recalculate formula on edit mode: Yes
    • Formula: dateDiffDays(Current Date, StartDate)

1.png

 

Under the Formula Builder we choose “dateDiffDays” under the Runtime Functions tab and “Current Date” under the Common Tab. The “StartDate” is located under Named Controls tab and will vary depending on what column you are referencing in your list.

2.png

Step 3:

Select the “End Date” control and click “Add Rule”

3.png

Step 4:

Under the Rules window create a Validation Rule:

  • Name: DateValidationRule
  • Rule Type: Validation
  • Condition: (varStartDate <= 11) || (dateDiffDays(StartDate, EndDate) >= 7)
  • Message: The Start Date is less than 11 days from today or the end date is less than 7 days from the start date, please update the appropriate date.

4.png

Under the Formula Builder for the Condition we choose to add the “varStartDate” from the Forms Variable Tab, and stated if the varStartDate is less than or equal to 11 days show the message.

We than state OR if the differences between the start date and end date controls is greater than or equal to 7 days to show the message.

 

Results:

The Results will be that this Validation rule will show the Message to the user when the hit save and these conditions are not met.

From here you can add additional validation or add additional validation rules and have the form show multiple messages specific to the failed validation.

5.png

Outcomes