How can I calculate the age of my form user and assign them to a specific divison base on their age?

  • khaji
    Asked on February 28, 2015 at 12:10 AM

    Is it possible to change the value of a field based on a users age/date?

    For instance, I am creating a form for registration and want to add users to a specific division based on their age. I have field called birthday as a date field and a dropdown field with a list of divisions. As an example, if someone is 10 years or younger they should be in my kids division but someone 18 or older should be in my adult division.

  • mayur5478
    Replied on February 28, 2015 at 1:38 AM

    If you can calculate the age of the user , then you can use conditional logic on that calculated value to update your drop down list.

    Use a number field in which you get calculated value of age of the user . Then use conditional logic as below on the number field. In the below case , division is the name of the drop down list.

    How can I calculate the age of my form user and assign them to a specific divison base on their age? Image 1 Screenshot 20

    Thanks,

    Mayur

     

     

  • Sean
    Replied on February 28, 2015 at 7:05 AM

    Conditional logic statements with the aid of the form calculation field can be used to achieve this. Rather than using a drop down menu, a text box would be used to store the division the user would be assigned to.

    You can take a look at my test form - you can clone it if you wish:
    http://form.jotformpro.com/form/50582914256963 

    You should add 2 date fields to the form - one to store the birthday and other to store the current date. If you wish you can hide the current date field from the user and only display the birthday field.
    How can I calculate the age of my form user and assign them to a specific divison base on their age? Image 1 Screenshot 60

    You should add a Form Calculation widget to your form and enter the formula as you see below.

    How can I calculate the age of my form user and assign them to a specific divison base on their age? Image 2 Screenshot 71

    You can remove the decimal places if you wish by selecting the option that says Show Advance Options.

    How can I calculate the age of my form user and assign them to a specific divison base on their age? Image 3 Screenshot 82

    Now that you have this in place, it is time for you to create your conditional logic statement to store the assigned division base on the user's age. Before doing this add a text box to your form and label it as Assigned Division after which, you should follow the instructions below.

    How can I calculate the age of my form user and assign them to a specific divison base on their age? Image 4 Screenshot 93

    How can I calculate the age of my form user and assign them to a specific divison base on their age? Image 5 Screenshot 104

    You should repeat this process for all the other divisions you have - each having there own conditional logic statement to assign a division associated with their age. I hope this helps. If you need further assistance, please do not hesitate to inform us.


    Thank you