Hello,
I'm working on a form where a user selects from a few different products. I'd like a table on the same form to populate rows based on what product is chosen. Screenshot below:
First, the checkbox in red dictates which of the checkbox fields underneath will be displayed (no additional details are needed for propane). What I'd like to in the Gas Order Details table (in green) is populate a row with the Product field already filled out with whichever value(s) is selected in the Gas checkbox (also in green). So if they choose both Unleaded and Super Unleaded, two rows appear in that table, with one Product saying Unleaded and the other saying Super Unleaded. I'd want to do something similar for the fields in blue.
Is something like that possible without getting too crazy with any custom coding?
Question
Question
Forms - populate rows in table based on what's chosen in earlier checkboxes
Replies
Is more than one row per product selected expected? I.e. I select gas > unleaded and super unleaded. The table would have a max of two rows and the user can't add any more.
Or would there be a minimum of two rows but the user can add as many rows as they want for each of the selected products.
You're correct - I have these tables set up with a minimum of 1 row and a maximum of 2 rows. So if both unleaded and super unleaded are checked, the Gas table would have 2 rows. If only one of those is selected, it'll have 1 row.
Does that make sense? I've since changed this form to have a section for each product (unleaded, super unleaded, clear, ruby, propane) that only displays if the corresponding checkbox is selected. The section contains the Fill Tank and Quantity fields. This will probably be the simpler method.
That was going to be my recommendation based on the amount of rows needed. As you noted it is much simpler to setup and doesn't require the JS that the table implementation would.
You can still put the fields side-by-side to emulate the table structure though