elo80ka / django-dynamic-formset

A jQuery plugin that allows you dynamically add new forms to a rendered django formset.
677 stars 311 forks source link

Can't display delete link or update formset manager when loading formset in modal from ajax #150

Open neighlyd opened 6 years ago

neighlyd commented 6 years ago

This is a weird edge-case, but I figured I would report it anyway.

I have a formset that loads in a modal via ajax. I have two options:

1) run the script on the main page. 2) run the script on the modal page.

If I run the script on the main page, the delete links are added to the formset as usual. However, it doesn't update the formset manager as is required (making it useless).

If I place the script on the modal page (i.e. the one pulled using ajax), the delete links aren't shown (though add links are). However, this time it does update the formset manager as required.

I honestly can't figure out why. I have tried changing up where the script looks (i.e. which selector is used to find the formset - table, tr, containing div, etc.). Nothing is working.

It seems that even if I load the script in the modal itself, I am still receiving the ['ManagementForm data is missing or has been tampered with'] error.