[Zope] <input type=hidden value='<dtml-var x>' name=x> and LOOP

Jim Washington jwashin@vt.edu
Fri, 23 Mar 2001 14:38:26 -0500


hi, servel

stringify your i's:

s = s + "<input type=hidden value='%s' name='filename%s'>" %
((REQUEST.filename + str(i)), i)

or you can 

iterator = str(i)
s = s + "<input type=hidden value='%s' name='filename%s'>" %
((REQUEST.filename + iterator)), iterator)

(you may have to put some of the above lines back together.)

-- Jim Washington

servel yannick wrote:
> 
> I would like to use 12 files and I would like to use a loop to create an
> output similar to:
> 
> <input type=hidden value='D:\TEMP\DEFAULT.PR~' name='filename1'>
> <input type=hidden value='' name='filename2'>
> <input type=hidden value='D:\pagefile.sys' name='filename3'>
> ...
> <input type=hidden value='C:\pagefile.sys' name='filename12'>
> 
> To reach this result, I would like to use something similar to the following
> code:
> 
> def SaveMenu(self, REQUEST=None):
>         s=""
>         i = 1
> 
>         while i <= 12:
> 
>                 s = s + "<input type=hidden value='%s' name='filename%s'>" %
> ((REQUEST.filename + i), i)
>                 i = i + 1
>         return s
> 
> Indeed the statement REQUEST.filename + i is illegal. Is there any
> alternative to provide a similar result?