[Zope] Handling results from <select> tag

Alexander Staubo alex@mop.no
Fri, 7 May 1999 00:38:59 +0200


Dargh. Thanks a bunch.

Alexander Staubo
http://www.mop.no/~alex/
mailto:redhand@mop.no

>-----Original Message-----
>From: Michel Pelletier [mailto:michel@digicool.com]
>Sent: 6. mai 1999 23:37
>To: Alexander Staubo; Zope Mailing List (E-mail)
>Subject: RE: [Zope] Handling results from <select> tag
>
>
>
>
>> -----Original Message-----
>> From: Alexander Staubo [mailto:alex@mop.no]
>> Sent: Thursday, May 06, 1999 4:49 PM
>> To: Zope Mailing List (E-mail)
>> Subject: [Zope] Handling results from <select> tag
>> 
>> 
>> Consider a form:
>> 
>>   <form action="Post">
>>     <select name="Values" multiple>
>>       <option value="A">A</option>
>>       <option value="B">B</option>
>>       <option value="C">C</option>
>>    </select>
>>    ...
>> 
>> I have the request handling stuff working 100%, except for 
>> the case when
>> the user selects only a single value. This seems to be because Zope
>> converts result values to a list. So, if the user selects multiple
>> values, form.Values becomes a list, like:
>> 
>>   ['A', 'B', 'C']
>> 
>> But if the user selects a single value, form.Values becomes a single
>> value, like
>> 
>>   'A'
>> 
>> How do I effectively and foolproofly handle this sort of case?
>
>   <form action="Post">
>     <select name="Values:list" multiple>
>       <option value="A">A</option>
>       <option value="B">B</option>
>       <option value="C">C</option>
>    </select>
>
>
>will allways make 'Values' a list.
>
>-mICHEL
>