[Zope] Handling results from <select> tag

Michel Pelletier michel@digicool.com
Thu, 6 May 1999 17:28:22 -0400


> -----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