Change the number of forms based on user input

Hello - I am making a college calculator in which there is a form in which the user inputs age of child, current savings and target college amount, and we tell them how much they need to save every month. Since people have multiple kids, they first specify how many kids they have. Depending on this, we repeat this form for multiple kids. For eg, if they choose ‘2 kids’, we will show the form 2 times so that they can input this info for each kid. Then they click Submit and we return data on monthly savings.

I am not sure how to build the logic to change the number of times the form is shown based on user input. Can anyone help? Thanks!

Hi there, @arundhati… there are a number of ways you can do what you have described, but if it was me, I think I might have a field on the User data type where I save the number of kids as soon as that number is entered. Then, when the info for the first kid is submitted, I would subtract 1 from the saved number of kids, and I would show the form again only when the resulting number is greater than 0. Make sense?

Hope this helps.

Best…
Mike

1 Like

Thanks a lot!

1 Like