2 Replies Latest reply on Nov 10, 2016 1:36 PM by gkaiseril

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

    kozak1972nj

      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.

        • 1. Re: Need help to mark checkbox based on DOB field(only when younger than 18)
          gkaiseril MVP & Adobe Community Professional

          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.

          • 2. Re: Need help to mark checkbox based on DOB field(only when younger than 18)
            gkaiseril MVP & Adobe Community Professional

            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;