Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Few formsets on one page #23

Closed
elo80ka opened this issue Feb 27, 2014 · 4 comments
Closed

Few formsets on one page #23

elo80ka opened this issue Feb 27, 2014 · 4 comments

Comments

@elo80ka
Copy link
Owner

elo80ka commented Feb 27, 2014

From 4ro...@gmail.com on February 02, 2011 14:14:18

What steps will reproduce the problem? 1. Add few formsets in a page, for instance

{{ formset1.management_form }}
{% for form in formset1.forms %}


{{ form }}

{% endfor %}

<script type="text/javascript"> $('.form1').formset({ prefix: '{{ formset1.prefix }}', addText: '+', deleteText: '-', }) </script>

{{ formset2.management_form }}
{% for form in formset2.forms %}


{{ form }}

{% endfor %}

<script type="text/javascript"> $('.form2').formset({ prefix: '{{ formset2.prefix }}', addText: '+', deleteText: '-', }) </script>
  1. Press delete button for one form
  2. Attribute 'name' will be changed in elements of another form

Little patch for fix this bug.

Attachment: delete.patch

Original issue: http://code.google.com/p/django-dynamic-formset/issues/detail?id=23

@elo80ka elo80ka self-assigned this Feb 27, 2014
@elo80ka
Copy link
Owner Author

elo80ka commented Feb 27, 2014

From stan.madueke on February 08, 2011 21:08:30

Status: Accepted
Owner: stan.madueke

@elo80ka
Copy link
Owner Author

elo80ka commented Feb 27, 2014

From stan.madueke on April 20, 2011 04:37:53

Looking at your example, it appears you forgot to specify a unique formCssClass for each formset. The documentation states:

    Internally, all forms with the same [formCssClass] are assumed to
    belong to the same formset. If you have multiple formsets on a single
    HTML page, you MUST provide unique class names for each formset. If
    you don't provide a value, this defaults to "dynamic-form".

The $(...).selector property is an elegant way to identify which forms belong to a formset (and would eliminate the need for unique formCssClasses). However, there seem to be restrictions on when it can be used reliably, which makes me think perhaps, that being explicit is better.

I'm marking this Invalid, since multiple formsets work fine, so long as each one has a unique formCssClass (as per the documentation). Thanks for taking the time to contribute anyway :)

Status: Invalid

@elo80ka
Copy link
Owner Author

elo80ka commented Feb 27, 2014

From stan.madueke on April 20, 2011 22:25:28

This issue was closed by revision r15 .

Status: Fixed

@elo80ka
Copy link
Owner Author

elo80ka commented Feb 27, 2014

From stan.madueke on February 24, 2014 14:36:45

This issue was closed by revision 23827c5 .

@elo80ka elo80ka closed this as completed Feb 27, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant