Hi all. I'm doing a bunch of HTML form processing, and part of that is allowing the user to select a number of elements from a multi-select list. If the user selects 2 or more items, I get a python list back, which is great. I can use a <dtml-in ...> to process it. The problem is, if only one item is selected, I *don't* get a list, and my <dtml-in ...> barfs, complaining that I can't pass it a string. Is there any way I can FORCE the value to be a list, even if there's only one element? Or maybe make dtml just "shut up and do it", or do I have to have some kind of hacky dtml? Or do I have to abandon dtml for this and go for a script? Thanks, Colin -- Colin Fox cfox@crystalcherry.com CF Consulting Inc. GPG Fingerprint: D8F0 84E7 E7CC 5C6C 9982 F1A7 A3EB 6EA3 BC97 572F
Colin Fox wrote:
Hi all.
I'm doing a bunch of HTML form processing, and part of that is allowing the user to select a number of elements from a multi-select list.
If the user selects 2 or more items, I get a python list back, which is great. I can use a <dtml-in ...> to process it.
The problem is, if only one item is selected, I *don't* get a list, and my <dtml-in ...> barfs, complaining that I can't pass it a string.
Is there any way I can FORCE the value to be a list, even if there's only one element? Or maybe make dtml just "shut up and do it", or do I have to have some kind of hacky dtml? Or do I have to abandon dtml for this and go for a script?
Relax. There is a way. Append ":list" to the name attribute of the form element. e.g., <select name="myList:list"> -- Jim Washington
On Thu, 2002-04-04 at 18:45, Jim Washington wrote:
Relax. There is a way. Append ":list" to the name attribute of the form element.
e.g.,
<select name="myList:list">
Thanks! That did the trick. I did read through the zope book (in what I thought were the relevant sections) and I couldn't find anything to help. Is this documented in the Zope book and I'm blind, or is it documented somewhere else? Regards, Colin -- Colin Fox cfox@crystalcherry.com CF Consulting Inc. GPG Fingerprint: D8F0 84E7 E7CC 5C6C 9982 F1A7 A3EB 6EA3 BC97 572F
It's in http://www.zope.org/Members/michel/ZB/ScriptingZope.dtml ----- Original Message ----- From: "Colin Fox" <cfox@crystalcherry.com> To: "Jim Washington" <jwashin@vt.edu> Cc: <zope@zope.org> Sent: Thursday, April 04, 2002 9:56 PM Subject: Re: [Zope] HTML Form processing
Colin Fox wrote:
On Thu, 2002-04-04 at 18:45, Jim Washington wrote:
Relax. There is a way. Append ":list" to the name attribute of the form element.
e.g.,
<select name="myList:list">
Thanks! That did the trick. I did read through the zope book (in what I thought were the relevant sections) and I couldn't find anything to help. Is this documented in the Zope book and I'm blind, or is it documented somewhere else?
nice howto: http://www.zope.org/Members/Zen/howto/FormVariableTypes ------------------------------------------------------------- Who's got only a hammer sees the world as a nail hans augustin (software developer) hans@beehive.de beehive elektronische medien GmbH http://www.beehive.de phone: +49 30 847-82 0 fax: +49 30 847-82 299
participants (4)
-
Chris McDonough -
Colin Fox -
hans -
Jim Washington