Skip to main content
Participant
November 9, 2016
Question

Need help to mark checkbox based on DOB field(only when younger than 18)

  • November 9, 2016
  • 2 replies
  • 349 views

I have a form where Date and DOB are populated from the system. I need help to mark the checkbox (Check Box2) if person in younger than 18. Please help.

This topic has been closed for replies.

2 replies

Inspiring
November 10, 2016

There have been many post about computing the age. Have you searched for any of these posts?co

The script needs to convert the date string to a JavaScript date object and then one has many options as how to compute the age by using the number of days in a year (hit it is not 365 for this calculation) or use the year, month and day of the 2 dates to compute the age.

Inspiring
November 10, 2016

The coding needed for this task is easier if one has a field to hold the result of calculating age, one field with one script. But since the check box field has no way to automatically compute, only when there is a change to the field, one needs to add a script to the "SYSACTUALDATE" and "BIRTHDATE" fields with only a minor variation. If a calculation field for the age is used, then there is only one script at one place that is used. The calculated age field serves as validation of calculation as well. You will need to update the code each year so having only one script to update may eliminate the error of not updating both scripts.

Validate Age is a sample form with your approach;