[Zope] variable length forms...

Andy McKay andym@ActiveState.com
Tue, 7 Nov 2000 08:52:56 -0800


<dtml-var "_['radiob'+_['sequence-item']]">

Will give you the item value. If you want to evaluate that value do:

<dtml-var "_[_['sequence-item']]">

or a little cleaner wrap it in a let so that

<dtml-let item=sequence-item>
<dtml-var "_[item]">
</dtml-let>

--
  Andy McKay, Developer.
  ActiveState.
----- Original Message -----
From: "zope" <zope@isp.lu>
To: <zope@zope.org>
Sent: Tuesday, November 07, 2000 1:55 AM
Subject: [Zope] variable length forms...


> Hi.
>
> I have tried to implement a variable length form.
>
> Yes, I have read
> http://www.zope.org/Members/jpenny/variable_length_forms/index_html.!
>
> I a form, I'm using following form fields:
>
> <dtml-in "_.range(1, _.string.atoi(form_numpages)+1, 1)">
> <tr align="center" valign="middle">
> <td><dtml-var sequence-number></td>
> <td><input type="text" name="form_time_out" size="6" maxlength="4"></td>
> <td><input type="radio" name="radiob<dtml-var sequence-number>"></td>
> <td><input type="radio" name="radiob<dtml-var sequence-number>"></td>
> </tr>
> </dtml-in>
>
> where form_numpages is a variable that i got from a previous form.
> This form works fine and generates me form_numpages lines with always one
> textfield and a group of 2 radiobuttons named per line.
>
> form_time_out  radiob1   radiob1
> form_time_out  radiob2   radiob2
> form_time_out  radiob3   radiob3
> ...
>
> The contents of this form is submitted and I want to interpret the data
> with following method:
>
> 1: <dtml-in "_.range(1, _.string.atoi(form_numpages)+1, 1)">
> 2: <dtml-var sequence-number>:
> 3: <dtml-var "_['radiob'+_['sequence-number']]">
> 4: </dtml-in>
>
> This returns the following Zope error:
>
> Error Type: TypeError
> Error Value: illegal argument type for built-in operation
>
> If I'm replacing the third line with <dtml-var "_['sequence-number']">,
the
> sequence-number is printed out. So I'm sure that it exits.
>
> How can I get the contents of radiob1, radiob2, radiob3, ...
>
> Thanks a lot for your help!
>
> Marc Ludwig
>
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )
>