Validating the Age of your Submitters

Do you want only people over a certain age to fill out your form? This is possible with date field calculations.

To get started, add a Date field and a Number field to your form. Number fields can be found in the Basic Fields section of the builder, while Date/Time fields are found in the Advanced Fields section:



Remove the 'Time' part of the Date/Time field by clicking the field and setting the 'Time Format' to -None- and Set the 'Allowed Years' to 'Current Year + 0 years' and Current Year - 100 years'.



Next, click the Number field, go to the field options along the left of the page, scroll down to the Default Value box, and click 'Use Date Calculation':



This will convert the area into the date calculation builder. There are three different dropdowns that will appear: Value 1, Value 2, and 'Expected result in'.



Set
the first dropdown to be the Date/Time field added to the form and set the second dropdown to the Current Date. The third dropdown determines what value the result will be calculated as: days, months, or years. Set it to 'Years'.



Finally, add a minimum value to the number field. This should be the age (in years) that the submitter needs to be in order to submit the form. In this example, I want the submitter to be at least 21 years old.



Optionally, you can hide the Age number field on your form so the submitter won't see the field on the form.



Now, when someone tries to fill out the form and is under the minimum age set an error is thrown.




Related Articles:
Date/Time Field
Date/Time Field Calculations