cancel
Showing results for 
Search instead for 
Did you mean: 

Fun with Forms: Date Validation

Workflow Hero
12 3 4,762

When using Nintex Forms for submissions of surveys, promotions, or orders where a user must meet a certain age, Nintex Forms has you covered with Validation rules. For this example, we are opening a contest for a free bottle of a tasty beverage (which in the United States requires you to be 21 years old).

superAwesomeForm.jpg

If a user enters a birth date that is less than 21 years old, they will receive an error message:

superAwesomeFormwithError.jpg

To create a validation rule against the Date Picker control, we need to write a rule around the length of one day. To do that, you can use a calculated value control:

CalcVal.jpg

“Birthday” in the Formula field is the DatePicker control, named “Birthday”.

When previewing the form you will see that calculations of dates through integers are in milliseconds.

calcvalueRuntime.jpg

Now that we know the value of a date picker control, we can build a form variable to get the value required (NOTE: ensure data type is Integer):

formVariable.jpg

We can then build a Validation rule as follows to ensure that the Form Variable “birthdayCheck” is greater than 662688000.

ValidationRule.jpg

3 Comments
Workflow Hero

nice one, i have another issue with the date and time field, how can i validate only the time portion?

i need a validation that "Requested Meeting Time" should be >= 5 hours after the  Current Time, which is the form submission time

Workflow Hero

This is exactly the kind of validation I'm looking for, but I can't get it to work.

The calculation Current date - Birthday results in "#Value!". When I just reference the Birthday control in the Formula field, saving the calculated value to data type Integer, I'm not seeing the milliseconds either. 

Since I'm working with European date notations, I've tried formatting all dates first (MM-dd-yyyy), however the result is still the same.

I need this information in a document generation action, for a clause that applies to customers aged 21 and over. I thought about using DayDiffDates instead, then dividing by 365, but with leap years that wouldn't be very accurate either.

I know this is an old post, but advice would be greatly appreciated!

Workflow Hero

Hi Yvette,

I just gave this a try in my environment and it worked. But I'm interested in your form configuration. Is it possible to send me your form.xml? Feel free to email me directly and I'll take a look at the formula.

Thank you,

Sean Fiene