"Django-Formset Add/Remove Buttons Not Working Inside Bootstrap Accordion" #213
Replies: 4 comments 4 replies
-
If collapsed accordion items use If you want me to check on this problem, please create an example inside the provided folders and point me onto your fork. |
Beta Was this translation helpful? Give feedback.
-
Please don't share your repository with me. Add a the minimum required to reproduce it using one of the many examples. Btw. In version 2.1, I will add collapsible collections. |
Beta Was this translation helpful? Give feedback.
-
This issue likely happens because the JS responsible for handling add/remove actions isn't re-binding to DOM elements inside collapsed accordion sections. Ensure that any dynamic logic (e.g., event listeners or mutation observers) is triggered after the accordion panel becomes visible. You can listen to the shown.bs.collapse event and re-bind handlers or re-initialize logic for the form fields inside the opened accordion section. Also, verify that template elements aren't being skipped by your JS init logic. |
Beta Was this translation helpful? Give feedback.
-
in order to make a formset more accessible, I want to organize it in Bootstrap5's nav-items. also, I am using floating labels. in general, is it possible to use custom forms rendering fields with {{ form.field }} or is passing css classes in the Collection class and usage of {{ form-collection }} advised and the way to go? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I actually have several forms, and each form contains dozens of fields. I don’t want to display them all together, so I opted for accordions. The only issue is that when I display the forms like this, everything works perfectly — including the add and remove buttons for one-to-many relationships. But when I try to display them inside accordions, they appear but don’t work.
`
Beta Was this translation helpful? Give feedback.
All reactions