Forum Academy Marketplace Showcase Pricing Features

Calculating age and using custom state to set age category


Am trying to set up a form where a birthdate is entered and then age is automatically calculated/displayed and an age category is assigned/displayed (25 or younger / 26 or older).

Copied a solution from a different forum question to calculate / display age (Text Age Dynamic, number), which works well.
Have set a custom state on this text element (Age Calculated, number) and am trying to display text using conditionals but nothing is displaying.

Am new to custom states - any suggestions on how to make it work?


Hi there, @kunigunda… if I understand your post correctly, what you are trying to do should be pretty straightforward. Can you share a screenshot of the workflow that sets the custom state’s value when the input where the birthdate is entered is changed?


I was hoping to set the custom state on the field and then refer to it in the conditionals (similar to setting the conditionals on a checkbox) without having to click a button to start a workflow - but i guess that’s not the case…?
Have tried to save displayed age as a field in DB (Age = Age Dynamic’s Age Calculated) and then tried displaying from DB (referencing Age in Conditionals instead of Text Age Dynamic’s Age Calculated) but that didn’t work either.
How do i save Age as a number in the DB?
And is it possible to display text based on Age Calculated without a workflow?
Many thanks

You can run a workflow without clicking a button by using a workflow event such as An input’s value is changed. So, when the birthdate input is changed (i.e., the user enters a birthdate into the input), you could use that workflow event to set the custom state’s value to the calculated age. Then, you can use the custom state’s value in conditionals on elements to do something on the page. Does that sound like what you are trying to do?

If it helps, here is an example of what I have described.

I have a date picker on the page that a user would use to select their birthdate. Then, this text element (which has a custom state associated with it) displays the calculated age based on the selected birthdate.

Here is the workflow that sets the custom state’s value when the date picker’s value is changed.

Finally, here is a conditional on an icon that shows the icon when the calculated age is less than or equal to 25.


Hi Mike
Yes, would be great, but can’t seem to find the right combination of terms to set the custom’s state’s value properly…
Am obviously missing something very basic :frowning:
Thanks again

Check out the example I posted (I think our responses kind of crossed there).

Thanks, Mike - took awhile bc i didn’t realize you have to display the group and hide the individual elements inside the group for elements to display properly (ergh) thanks again!

1 Like