jazzband / django-smart-selects

chained and grouped selects for django forms
https://django-smart-selects.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
1.12k stars 352 forks source link

Django smart selects doesn't work with JS cloning #345

Open dogzillaa opened 1 year ago

dogzillaa commented 1 year ago

I'm trying to create a page with ability to add any amount of form-copy. I use django-smart-selects to make my form's field chained. It works fine if I have only 1 form on page.

Then I'm using javascript to make a function to clone form instance by pressing button and addind new form's ids to these clones.

Actual behavior

The problem is when I press "+" button I get new cloned form on page, but chained-selection doesn't work anymore(only first one still works), and it seems that this clone copying all my choices from the firs form and remembering this state.