Skip to main content

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 andor 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

On Flexi task it does not work.


Is there a way that this can be done with a date/time field where the variable will ignore the time field? I am getting an error message because it is saying it can't calculate the SetMinutes.


I am testing Forms out. I have some date fields I need to turn off validation on, which I did, but I am still unable to use "Unk" or "Unknown" or any thing but a date. How do I get around this with out using a text box?

Thanks.


this does not work on mobile.


Reply