[Zope] DTML form variable name cocatenation

Mike Doanh Tran mtran@shufflemasterrd.com
Wed, 25 Jun 2003 14:52:38 -0600


use <dtml-var sequence-number>:
<dtml-in SQL_getMath>
  <input name="i<dtml-var sequence-number>" type="checkbox" value="1" >
</dtml-in>
See section Appendix A of Zope Book under "in:  Loops Over Sequences"  for
more details.

Cheers,

Mike

On Wednesday 25 June 2003 01:26 pm, you wrote:
> Would anyone have a suggestion on how to do this in DTML?
>
> I have a dtml-in statment that returns a variable number of values
> from a database field "standard_text" from a MySQL database.  What I
> need to do is replace the <input name="i" ..> name value with a
> unique variable name for each iteration.
>
> <dtml-in SQL_getMath>
>   <input name="i" type="checkbox" value="1" ><br>
> </dtml-in>
>
> Optimally this would output something like:
>
> <input name="i1" type="checkbox" value="1" ><br>
> <input name="i2" type="checkbox" value="1" ><br>
> <input name="i3" type="checkbox" value="1" ><br>
>
> Where the letter "i" is cocatenated to a incremeting value to
> construct the form checkboxes name value.
>
> My guess is that the solution would have something to do with
> cocatenation and looping. Any suggestions?
>
> Harlow Pinson
> Indepth Learning
> Email: hpinson@indepthl.com
> Web: http://www.indepthl.com
> Voice: 505-994-2135
> FAX: 208-475-7678
>
>