[Zope] list -> string -> list

Chris Withers chrisw@nipltd.com
Tue, 13 Aug 2002 13:49:45 +0100


(this belongs on zope@zope.rog so I've moved it there...)

Bryan C. Andregg wrote:
> I have a form on which I am doing some verification and if the verification
> fails returns the same form with fields already filled in where possibe using
> REQUEST. One road block that I've run into is a set of checkboxes that I have.
> My verification script can deal correctly with them regardless whether or not
> it's sent a list, and string, or nothing it all. In passing back to the
> calling form I thought I'd do something like use url_quote to pass REQUEST
> something like:
> 
>   myForm?list=%5B%27checkbox_1%27%2C%20%27checkbox_2%27%5D

Eek! Erk! Yuk! Don't do that ;-)

More helpfully:

The above if very fragile and unsightly. Rather than doing a redirect to get 
back to your form, just return it at the end of your validation script, should 
the values not be good enough:

return context.myForm()

...that way you'll still have the original request and won't need ot do any 
nastiness to pass values around.

cheers,

Chris