[Zope-dev] Order of Form Keys in REQUEST
Sandra Chong
sandra.chong at b-online.com.au
Wed Mar 10 20:07:48 EST 2004
Oops, sorry about that. It's hard to tell just by the descriptions on
Zope.org which is the best list for what.
Thanks for the other tip. :) I'll probably stick with holding a server-side
array with the info, though, as I might decide later to dynamically generate
the forms (there are a few) using the data held in there.
> -----Original Message-----
> From: Max M [mailto:maxm at mxm.dk]
> Sent: Thursday, 11 March 2004 9:05 AM
> To: Sandra Chong
> Cc: zope-dev at zope.org
> Subject: Re: [Zope-dev] Order of Form Keys in REQUEST
>
>
> Sandra Chong wrote:
> > Thank you so much. :D You guys are legends. I will try keeping
> a separate
> > ordered list and save it in the session for the form handler to
> refer to.
> > Many thanks again. :)
>
>
> It is easier to save it in a hidden field in the form:
>
> <input type="hidden" name="sorted_keys" value="key1,key1,key3,key4">
>
> And then you can get it like (PythonScript):
>
> sorted_keys = REQUEST['sorted_keys'].split(',')
>
> But as far as I remember, a form keps the order of items in it, per the
> spec. So you could probably do:
>
> <tal:block tal:repeat="key sorted_keys">
> <input type="hidden" name="sorted_keys:list"
> tal:attributes="key">
> </tal:block>
>
> Which you can get like (PythonScript):
>
> sorted_keys = REQUEST['sorted_keys']
>
> And I am pretty shure that they are in order. But I could be wrong, so
> the first approach is probably the safest.
>
> Btw. These questions should really be asked on the Zope list, not
> zope-dev. zope-dev is for subjects regarding the development of zope,
> while the zope list is for development with Zope.
>
>
> regards Max M
>
More information about the Zope-Dev
mailing list