Is there a way to calculate the person's age based on a date field (MM/DD/YYYY)? I'd like to have the user enter their date of birth and after entering allow a hidden field or read-only field appear that shows their calculated age.
Is there a way to calculate the person's age based on a date field (MM/DD/YYYY)? I'd like to have the user enter their date of birth and after entering allow a hidden field or read-only field appear that shows their calculated age.
This isn't currently a built in feature. It could be accomplished as a customization.
- Add a hidden field to your form and position it below the date field
- Edit this hidden field and give it a Field Label of "Age"
- Save your form
Now use the gform_pre_submission hook and some custom code to then read the value of the date field, calculate the age, and store it in your hidden field.
Documentation for the gform_pre_submission hook can be found here:
http://www.gravityhelp.com/documentation/page/Gform_pre_submission