I have a django formset in which a form is dynamically being added and removed using jquery.formset.js. It keeps track of number of forms that are currently in a formset. But when I refresh the page, the number of forms in a formset doesn't get rest to 1, and due to min
and max
number of forms that can be added in the formset, it doesn't allow more forms to be added.
With Two forms:
After Refresh:
I should not have the choice to remove the form
but I can see it, because the number of forms still is stored as 2. And I can add only 1 more form, because maximum number of forms that can be added is 3.
Please help me handling this issue.
This is caused by browser trying to autocomplete all fields in your form to previous values. You can disable it by setting autocomplete="off"
on hidden fields that are affected by this issue.