Creating a form to dynamically add data from selected containers using for loop

I have created a survey form which allows the user enter data into a form listing their social connections. Each relation is a checkbox in a Checkbox Group. When each relation is selected, a container appears for that particular relation. (Each container has the same format with the same subfields inside the container.) When the user clicks Submit, I want the form to get each field in only the active containers and place them in the database table I specify. Since there are variable numbers of boxes checked, would a JS for loop with a temporary state be best for this?

Hey jrt10, happy to help here :grin: This sounds like it might be a great use case for a listview. You could add a container and checkbox to the listview and have the container be hidden / disabled based on the checkbox value. That way you could easily loop through the listview pulling the form data from containers associated with checked boxes. You would also easily be able to change the number of check boxes and containers based on dynamic inputs, and could still hide / disable the containers based on the checkboxes.

Here is what it could look like:

Do you think this could work for your use case here?