Opened 7 years ago

Last modified 7 years ago

#28672 closed Bug

CheckboxSelectMultiple does not correctly bind to the form attribute passed in when rendered outside its containing form — at Version 1

Reported by: Dylan Young Owned by: nobody
Component: Forms Version: 1.8
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Dylan Young)

This means that POSTing the form does not submit the accompanying selected data.

This seems to be an issue with attrs={'form': 'theform'} not being passed through to the underlying checkbox inputs.

SelectMultiple behaves as expected (submitting with the form).

Minimal (inefficient) Example (must be included on a page with a form named 'theform' to see the problematic POST):

class UserSelectForm(Form):
    selected_users = MultipleChoiceField(
                    choices=[('ex', 'Example'), ('ex2', 'Example2')],
                    initial='ex',
                    widget=CheckboxSelectMultiple(attrs={'form': 'theform'}),
                    required=True)

Not sure if this is fixed in Django>1.8 as I have found no other reference to the bug.

Change History (1)

comment:1 by Dylan Young, 7 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top