#27: Invalid generation of HTML with FormFieldRepeater
-------------------+--------------------------------------------------------
Reporter: ivan | Owner:
Type: defect | Status: new
Priority: major | Version: 0.9
Keywords: |
-------------------+--------------------------------------------------------
FormFieldRepeater generates html with invalid ID attribute for list item
and label.
contents of '''forms.py'''
{{{
class _ProcessForm(forms.ListForm):
class fields(WidgetsList):
test1 = forms.FormFieldRepeater(
id='qq',
name='ww',
label_text='lorem',
widget=forms.SingleSelectField(id='rr',
name='tt',
options=['1', '2', '3']))
test2 = forms.FormFieldRepeater(id='aa',
name='bb',
label_text='ipsum',
widget=forms.SingleSelectField(id='ff',
name='gg',
options=['a', 'b', 'c']))
ProcessForm = _ProcessForm('process')
}}}
generates
{{{
<form class="_processform" method="post" action="" id="process">
<ul class="field_list">
<li title="" id="process_container" class="even">
<label class="fieldlabel" for="process"
id="process_label">lorem</label>
<select id="process_test1-0" class="repeatedsingleselectfield"
name="tt-0">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
<select id="process_test1-1"
class="repeatedsingleselectfield" name="tt-1">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
<select id="process_test1-2"
class="repeatedsingleselectfield" name="tt-2">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
</li>
<li title="" id="process_container" class="odd">
<label class="fieldlabel" for="process"
id="process_label">ipsum</label>
<select id="process_test2-0" class="repeatedsingleselectfield"
name="gg-0">
<option value="a">a</option>
<option value="b">b</option>
<option value="c">c</option>
</select>
<select id="process_test2-1"
class="repeatedsingleselectfield" name="gg-1">
<option value="a">a</option>
<option value="b">b</option>
<option value="c">c</option>
</select>
<select id="process_test2-2"
class="repeatedsingleselectfield" name="gg-2">
<option value="a">a</option>
<option value="b">b</option>
<option value="c">c</option>
</select>
</li>
<li title="" id="process_submit_container" class="even">
<input type="submit" value="Submit" id="process_submit"
class="submitbutton"/>
</li>
</ul>
</form>
}}}
Notice the [[BR]]<li title="" '''id="process_container"''' class="even">
[[BR]] and [[BR]] <label class="fieldlabel" for="process"
'''id="process_label"'''>lorem</label>
I was building javascript-based dynamic growing repeater (because
tw.dynforms.GrowingTableForm works werid) and this was a problematic
issue. As a workaround I've created my own template for forms.ListForm,
because I've noticed that (in this template) in line 31
(id="${
field.id}_container") when
field.name was None, then
field.id was
invalid (and
field.name was None only when rendering FormFieldRepeater
(this may help somehow)
--
Ticket URL: <http://toscawidgets.org/trac/tw.forms/ticket/27>
tw.forms </trac/tw.forms>
tw.forms - Form building widgets