The Community forums are being phased out in favor of a new Slack group.
Add your email address below to get an invitation to join the community slack group
Add X number of a specific field based on number selected in dropdown
Hi there,
I have a dropdown option on a form for a travel website. One field is "Number of adults" with a dropdown where the user can select a number. I then have a section called "Adult Details" containing things like Name, age, contact details. I'd for the number of sections that appear to be based on the number selected in the dropdown. Is there a handy way to do this?
Many thanks.
October 17, 2018 at 10:47 am
The most simple method I can think of is to flip this upside down:
Use repeating fields to add rows of name/age/etc. The user would then add as many rows as they needed. You can then count the number of repeating fields (I think?). Here's details:
https://formidableforms.com/knowledgebase/repeatable-section/#kb-get-the-total-of-the-values-of-a-repeater-field
And here's an example of a form where I did something like that. The password for this page is "hotdogs": https://www.hartsvillesc.gov/test/parks-rec-participant-registration/
To do it in a way that's more like what you're asking, you could create, say 10 rows of name/age fields, or whatever an appropriate number is, and use conditional logic to only show some of them based on the value in "Number of Adults."
Row 1 would always be visible,
Row 2 would be visible if [Number of Adults] is greater than 1
Row 3 would be visible if [Number of Adults] is greater than 2
Row 4 would be visible if [Number of Adults] is greater than 3
...
That way is not difficult, it's just more tedious.
Discussion closed.