Re: [Zope] REQUEST.form variables order
On 24 Oct 2005, at 14:03, Krzysztof Kubacki wrote:
How to change it? I would like to have variables in the same order as I put them into internet form.
You can't. REQUEST.form is a dictionary. They are, by definition, unordered.
Why do you need them ordered? What is the use case?
In my "Send script" I collect all data from internet form and send to email. I want to have that data in the email in the same order it was placed in the internet form.
Please keep this on the list!
You'll have to add code to your script to order the form items yourself.
But the thing is that I don't have guarantee that user will not replace fields in the internet form(there is a possibility). Krzychu
--On 24. Oktober 2005 15:19:45 +0200 Krzysztof Kubacki <krzysztof.kubacki@bmpg.pl> wrote:
But the thing is that I don't have guarantee that user will not replace fields in the internet form(there is a possibility).
AFAIK there is no specification that requires form parameters to be submitted in the order as they appear within a form. Implemented behavior is nothing you can rely on. If you rely on it then you should verify your application design and data model. -aj
Krzysztof Kubacki schrieb:
On 24 Oct 2005, at 14:03, Krzysztof Kubacki wrote:
How to change it? I would like to have variables in the same order as I put them into internet form.
You can't. REQUEST.form is a dictionary. They are, by definition, unordered.
Why do you need them ordered? What is the use case?
In my "Send script" I collect all data from internet form and send to email. I want to have that data in the email in the same order it was placed in the internet form.
Please keep this on the list!
You'll have to add code to your script to order the form items yourself.
But the thing is that I don't have guarantee that user will not replace fields in the internet form(there is a possibility).
And how exactly would that help if your script isnt expecting the new fields anyway? I'd use the :list and :records modifier accordingly for keeping ordering where that matters. HTH Tino
Krzysztof Kubacki schrieb:
On 24 Oct 2005, at 14:03, Krzysztof Kubacki wrote:
How to change it? I would like to have variables in the same order as I put them into internet form.
You can't. REQUEST.form is a dictionary. They are, by definition, unordered.
Why do you need them ordered? What is the use case?
In my "Send script" I collect all data from internet form and send to email. I want to have that data in the email in the same order it was placed in the internet form.
Please keep this on the list!
You'll have to add code to your script to order the form items yourself.
But the thing is that I don't have guarantee that user will not replace fields in the internet form(there is a possibility).
And how exactly would that help if your script isnt expecting the new fields anyway?
I'd use the :list and :records modifier accordingly for keeping ordering where that matters.
The thing is that there is possibility to change fields order by the mean of WYSIWYG editor by the user. If he change order I would expect to get the same order in REQUEST object. Regards Krzychu
...
And how exactly would that help if your script isnt expecting the new fields anyway?
I'd use the :list and :records modifier accordingly for keeping ordering where that matters.
The thing is that there is possibility to change fields order by the mean of WYSIWYG editor by the user. If he change order I would expect to get the same order in REQUEST object.
You cant. If you need to maintain order of fields, use :list or :records e.g. <input type="text" name="field:list" /> <input type="text" name="field:list" /> and so on. Then you get a list for field and the elements are in the expected order. You might read on that matter a bit: http://zopewiki.org/ZPublisher
participants (3)
-
Andreas Jung -
Krzysztof Kubacki -
Tino Wildenhain