[Zope] Re: Casting to a list
Alexandre Ratti
alex@gabuzomeu.net
Thu, 23 Mar 2000 12:26:12 +0100
Hello,
At 11:08 22/03/2000 -0800, you wrote:
>Date: Wed, 22 Mar 2000 11:31:04 -0700
>From: Ken Kinder <kkinder@messagemedia.com>
>Subject: [Zope] Casting to a list
>
>Another question (soon I'll start answering more on this list :) - I
>have a set of checkboxes with the same name that I iterate through
>using dtml-in. However, when only one checkbox is checked, dtml-in
>complains that a string cannot be used as input, it expects a
>sequence.
You can specify ":list" in your checkbox code to typecast the input.
Here is a quick test. The list should display OK when one checkbox is checked.
<FORM method="post">
<INPUT type="checkbox" name="myList:list" value="First">First<BR>
<INPUT type="checkbox" name="myList:list" value="Second">Second<BR>
<dtml-if btOK>
<dtml-if myList>
<SELECT name="myList">
<dtml-in myList>
<OPTION><dtml-var sequence-item></OPTION>
</dtml-in>
</SELECT>
</dtml-if>
</dtml-if>
<INPUT type="submit" name="btOK" value="OK">
</FORM>
For more info see this howto:
<http://www.zope.org/Members/Zen/howto/FormVariableTypes>.
Cheers.
Alexandre