You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sometimes it is necessary to create multiple groups of the same type. Imagine we have a form that asks about the addresses a person lived at within 10 years. Each address should consist of the following fields:
Rather than copy-pasting 10..20 groups in the form definition we could set a quantity: 10 or multiple: true parameter which will render these groups automatically. Each group will have its number in the name, like page_mygroup_1 with field names like page_mygroup_1_city.
The question is how it will be rendered in the Rails app. Obviously we should not show to a user 10 groups all at once. I see two ways of doing it:
Controlling dropdown
Link group visibility to a dropdown with numbers 0..10. When a user selects the quantity of groups the corresponding amount of groups become visible.
Add more / Delete buttons
A group is rendered as a template that will be used by js to generate more groups. When a user clicks on "Add More" a new group is generated and becomes visible. Next to the group will be a button to delete this group.
Any other ideas are welcome!
The text was updated successfully, but these errors were encountered:
Sometimes it is necessary to create multiple groups of the same type. Imagine we have a form that asks about the addresses a person lived at within 10 years. Each address should consist of the following fields:
Rather than copy-pasting 10..20 groups in the form definition we could set a
quantity: 10
ormultiple: true
parameter which will render these groups automatically. Each group will have its number in the name, likepage_mygroup_1
with field names likepage_mygroup_1_city
.The question is how it will be rendered in the Rails app. Obviously we should not show to a user 10 groups all at once. I see two ways of doing it:
Link group visibility to a dropdown with numbers 0..10. When a user selects the quantity of groups the corresponding amount of groups become visible.
A group is rendered as a template that will be used by js to generate more groups. When a user clicks on "Add More" a new group is generated and becomes visible. Next to the group will be a button to delete this group.
Any other ideas are welcome!
The text was updated successfully, but these errors were encountered: