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.
Create a list with a “Start Date” and “End Date” column of data type “Date and time”.
- 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)
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.
Select the “End Date” control and click “Add Rule”
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.
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.
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.