[Zope] Sorting and accessing elements in the

Andy McKay andym@ActiveState.com
Tue, 3 Oct 2000 09:37:28 -0700


You need to let item=sequence-item since sequence-item is interpreted in
python as a mathemtical operation sequence minus item.

<dtml-var standard_html_header>

<dtml-call "REQUEST.set('keys', REQUEST.form.keys())">
<dtml-call "keys.sort()">

<dtml-in keys>
    <dtml-let item=sequence-item><dtml-var item>:
    <dtml-var "REQUEST.form[item]">
    </dtml-let>
</dtml-in>
<dtml-var standard_html_footer>


----- Original Message -----
From: "Max Møller Rasmussen" <maxm@normik.dk>
To: <zope@zope.org>
Sent: Tuesday, October 03, 2000 8:05 AM
Subject: [Zope] Sorting and accessing elements in the


> I am making a mailer zClass where it will only be nessecary to make the
form
> fields with the values you want to send, then the zClass will give you a
> reply on the webpage and send a nicely formatted e-mail.
>
> The problem is that the form elements are unknown but they need to be set
up
> in predictable order to format the output automatically.
>
> To do this I need the form values in a sorted order. I can then give the
> form fields names like this:
>
> <input type=text name="1) First Name" value="Max M">
> <input type=text name="2) Last Name" value ="Rasmussen">
>
> ------------------------------------
>
> Then the mail can be automatically formatted like this:
>
> 1) First Name
> Max M
>
> 2) Last Name
> Rasmussen
>
> etc....
>
> ------------------------------------
>
> I have tried to use the sequence-item as a key in REQUEST.form, but it
> doesn't work like I want it to.
>
> ---------------------------------
>
> <dtml-var standard_html_header>
>
> <dtml-var webReply><p>
> <dtml-call "REQUEST.set('keys', REQUEST.form.keys())">
> <dtml-call "keys.sort()">
>
> <dtml-in keys>
>     <dtml-var sequence-item>:<br>
>     <dtml-var "REQUEST.form[sequence-item]"><p>  <---- THIS IS WHAT DOESNT
> WORK
> </dtml-in>
>
> <dtml-var standard_html_footer>
>
> ---------------------------------
>
> Regards Max M
>
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )
>