#8655: MultiValueField does not render correctly with as_hidden
---------------------+------------------------------------------------------
Reporter: bthomas | Owner: nobody
Status: new | Milestone:
Component: Forms | Version: SVN
Keywords: | Stage: Unreviewed
Has_patch: 0 |
---------------------+------------------------------------------------------
MultiValueField needs to define hidden_widget = MultipleHiddenInput so
that it will work properly when rendered with as_hidden(). However,
MultipleHiddenInput still doesn't render IDs the same way as MultiWidget
does, so MultiWidget's value_from_datadict will not find the values that
MultipleHiddenInput has rendered. Or something like that. I'm concerned
that trying to fix MultipleHiddenInput to work with MultiValueField will
break MultipleChoiceField, so fixing this may require another Widget
class.
A concrete example for this is using form preview with a
SplitDateTimeField. The preview page renders all fields with as_hidden(),
which creates a field like
{{{
<input type="hidden" name="delay_start" value="[u'2008-08-29',
u'00:00:00']" id="formtools_delay_start" />
}}}
...which can't be turned back into valid data. It needs to render multiple
hidden fields like:
{{{
<input type="hidden" name="delay_start_0" value="2008-08-29"
id="formtools_delay_start_0" />
<input type="hidden" name="delay_start_1" value="00:00:00"
id="formtools_delay_start_1" />
}}}
Using MultipleHiddenInput creates 2 hidden fields, but does not append the
_i to each name and ID, so the data still does not get read back correctly
by the form.
--
Ticket URL: <http://code.djangoproject.com/ticket/8655>
Django Code <http://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 post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---