#28672: CheckboxSelectMultiple does not correctly bind to the form attribute
passed
in when rendered outside its containing form
-----------------------------+--------------------------------------
Reporter: Dylan Young | Owner: nobody
Type: Bug | Status: new
Component: Forms | Version: 1.8
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------+--------------------------------------
Description changed by Dylan Young:
Old description:
> 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=User.objects.all()[0:4],
> initial=User.objects.all()[0:4],
> widget=SelectMultiple(attrs={'form': 'theform'}),
> required=True)
> }}}
>
> Not sure if this is fixed in Django>1.8
New description:
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.
--
--
Ticket URL: <https://code.djangoproject.com/ticket/28672#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/068.ad07a43bc48b5b3a6809b8f6ad291b55%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.