[Zope] Re: forms and variable mix-ups

Hung Jung Lu hungjunglu@hotmail.com
Tue, 04 Jan 2000 20:51:09 PST


ed colmar wrote:
>
>     Problem 2:  I have a select box, that I want people to be able to 
>select
>multiple items from.  The selecting and submission seems to work, but I
>can't get them to display in the editPersonFrom page.  I got this list into
>the addSRPerson method by using "styles=[]" is this the right way to do it?
>Also, how to make it not freak out with a single selection.  Do I force it
>into a list on the input form?

I don't know whether this is the same problem I had recently or not. But, 
anyway, for the <select ... multiple> tag, you are almost surely better off 
if you specify the ":list" switch in the name. That is, change NAME="styles" 
to NAME="styles:list". This way, it won't freak out when a single item is 
selected. The reason is: when a single item is selected and you don't have 
the ":list" suffix, the form returns a string instead of a list of one 
single string. I have no clue whether this is problem of HTML/Python/Zope... 
(I asked the question but got no answer, sorry.)

  <SELECT NAME="styles:list" size="4" multiple>
  <OPTION VALUE="" SELECTED>&nbsp;
  <dtml-in styles_list>
  <OPTION VALUE="<dtml-var sequence-item html_quote>"><dtml-var
sequence-item>
  </dtml-in styles_list>
  </SELECT>

hope this works,

Hung Jung


______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com