#11836: Missing django.forms.widgets.MultiWidget hidden counterpart
---------------------------------+------------------------------------------
          Reporter:  sayane      |         Owner:  nobody
            Status:  closed      |     Milestone:        
         Component:  Forms       |       Version:  1.1   
        Resolution:  invalid     |      Keywords:        
             Stage:  Unreviewed  |     Has_patch:  0     
        Needs_docs:  0           |   Needs_tests:  0     
Needs_better_patch:  0           |  
---------------------------------+------------------------------------------
Comment (by sayane):

 Here is a simple example. MultiLineAddressWidget is a subclass of
 MultiWidget.
 {{{
 In [26]: w = MultiLineAddressWidget()

 In [27]: w.render("myname", ["line1", "line2", "line3"])
 Out[27]: u'<input type="text" name="myname_0" value="line1" /><br /><input
 type="text" name="myname_1" value="line2" /><br /><input type="text"
 name="myname_2" value="line3" />'

 In [28]: w = forms.MultipleHiddenInput()

 In [29]: w.render("myname", ["line1", "line2", "line3"])
 Out[29]: u'<input type="hidden" name="myname" value="line1" />\n<input
 type="hidden" name="myname" value="line2" />\n<input type="hidden"
 name="myname" value="line3" />'

 In [30]:

 }}}

 {{{
 In [36]: data = {'myname': ['line1', 'line2', 'line3']}

 In [37]: w = forms.MultipleHiddenInput()

 In [38]: w.value_from_datadict(data, {}, "myname")
 Out[38]: ['line1', 'line2', 'line3']

 In [39]: w = MultiLineAddressWidget()

 In [40]: w.value_from_datadict(data, {}, "myname")
 Out[40]: [None, None, None]

 }}}

 I forgot to say that MultiValueField uses MultipleHiddenInput as default
 hidden widget.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/11836#comment:5>
Django <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.

Reply via email to