[Zope] Sequence-Item
Ben Ocean
zope@thewebsons.com
Sun, 28 Oct 2001 10:15:08 -0800
At 06:31 PM 10/28/01 +0100, you wrote:
>Try using <dtml-if "_['sequence-item']==... instead of <dtml-if
>"sequence-item==....
Worked like a charm, thank you! Now, I have this code with unusual output:
<dtml-if expr="number_attendees==1">
Thank you, <dtml-var first_name>. Please tell us about the
attendee...<br> <br>
<dtml-else>
Thank you, <dtml-var first_name>. Please tell us about the
attendees...<br> <br>
</dtml-if>
<center>
<dtml-var "seminar_form_2.header()">
<table border="0">
<dtml-in expr="_.range(number_attendees)">
<dtml-if "_['sequence-item']==0">
1st Attendee:<br>
<dtml-in "seminar_form_2.get_fields()">
<dtml-let field=sequence-item>
<tr>
<td><dtml-var "field.get_value('title')"></td>
<td><dtml-var "field.render()"></td>
</tr>
</dtml-let>
</dtml-in><br> <br>
<dtml-elif "_['sequence-item']==1">
2nd Attendee:<br>
<dtml-in "seminar_form_2.get_fields()">
<dtml-let field=sequence-item>
<tr>
<td><dtml-var "field.get_value('title')"></td>
<td><dtml-var "field.render()"></td>
</tr>
</dtml-let>
</dtml-in><br> <br>
<dtml-elif "_['sequence-item']==2">
3rd Attendee:<br>
<dtml-in "seminar_form_2.get_fields()">
<dtml-let field=sequence-item>
<tr>
<td><dtml-var "field.get_value('title')"></td>
<td><dtml-var "field.render()"></td>
</tr>
</dtml-let>
</dtml-in><br> <br>
<dtml-else>
<dtml-var expr="_['sequence-item'] + 1">th Attendee:<br>
<dtml-in "seminar_form_2.get_fields()">
<dtml-let field=sequence-item>
<tr>
<td><dtml-var "field.get_value('title')"></td>
<td><dtml-var "field.render()"></td>
</tr>
</dtml-let>
</dtml-in><br> <br>
</dtml-if>
</dtml-in>
<tr>
<td><input type="submit" value=" OK "></td>
</tr>
</table>
<dtml-var "seminar_form.footer()">
</center>
When number_attendees == 4 I get this output:
1st Attendee:
2nd Attendee:
3rd Attendee:
4th Attendee:
<first set of fields from the form>
<second set of fields from the form>
<third set of fields from the form>
<fourth set of fields from the form>
Why don't the form fields appear in sequence under the headers instead of
at the end?
TIA,
BenO