Is there an easy way?..
I have a form that has 12 checkboxes on it. On the action URL, I have an in tag, which iterates over the ?list? of checkboxes. Problem is, when one or none are checked, zope complains about the stuff being a string, and refuses to do anything. Quick fix please? -Thanks in advance. -- ------------------------------------------------------------ "One World, One Web, One Program" - Microsoft Promotional Ad "Ein Volk, Ein Reich, Ein Fuhrer" - Adolf Hitler ------------------------------------------------------------
At 11:17 13/10/99 , Morten W. Petersen wrote:
I have a form that has 12 checkboxes on it. On the action URL, I have an in tag, which iterates over the ?list? of checkboxes. Problem is, when one or none are checked, zope complains about the stuff being a string, and refuses to do anything. Quick fix please?
Add :list to the namefield of the checkboxes. That way it will always be alist. -- Martijn Pieters, Web Developer | Antraciet http://www.antraciet.nl | Tel: +31-35-7502100 Fax: +31-35-7502111 | mailto:mj@antraciet.nl http://www.antraciet.nl/~mj | PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149 ------------------------------------------
-----Original Message----- From: morphex@online.no [mailto:morphex@online.no]On Behalf Of Morten W. Petersen Sent: Wednesday, October 13, 1999 11:18 AM To: zope@zope.org Subject: [Zope] Is there an easy way?..
I have a form that has 12 checkboxes on it. On the action URL, I have an in tag, which iterates over the ?list? of checkboxes. Problem is, when one or none are checked, zope complains about the stuff being a string, and refuses to do anything. Quick fix please?
-Thanks in advance.
In your form ad a :list piece to the checkbox items As follows: <input type=checkbox name=option:list> This automatically changes the option to a list, even if there is just one. I do not think this will handle the case in which no checkbox is checked. To do this , you will have to add a condition to the action dtml method: <dtml-if "REQUEST.has_key('option')"> your stuff </dtml-if> Rik
Rik Hoekstra wrote:
This automatically changes the option to a list, even if there is just one. I do not think this will handle the case in which no checkbox is checked. To do this , you will have to add a condition to the action dtml method:
<dtml-if "REQUEST.has_key('option')"> your stuff </dtml-if>
Or just <dtml-if option>. This is a good idea, because whether or not the list gets assigned for no-checked boxes depends on how the browser sends the form data, if the browser assumes no checked boxes means don't even send the form element, then you will need to sniff for the assignment first, as you suggested. -Michel
-----Original Message----- From: michel@digicool.com [mailto:michel@digicool.com] Sent: Wednesday, October 13, 1999 4:04 PM To: hoekstra@fsw.LeidenUniv.nl Cc: Morten W. Petersen; zope@zope.org Subject: Re: [Zope] Is there an easy way?..
Rik Hoekstra wrote:
This automatically changes the option to a list, even if there is just one. I do not think this will handle the case in which no checkbox is checked. To do this , you will have to add a condition to the action dtml method:
<dtml-if "REQUEST.has_key('option')"> your stuff </dtml-if>
Or just <dtml-if option>.
Though in my experience this may stumble with a KeyError if the request object has no option key Rik
Are there a listing over the ":keyword" keywords anywhere? If there is none, a HOWTO would be nice. Just give me a referense, and I'll write the HOWTO. //johan
At 12:17 14/10/99 , Johan Carlsson wrote:
Are there a listing over the ":keyword" keywords anywhere? If there is none, a HOWTO would be nice.
Just give me a referense, and I'll write the HOWTO.
The only complete list I know of is the old Trinkets Tutorial: http://www.zope.org:8080/Documentation/Reference/Trinkets There is a table with all marshalling modifiers about a third down. Search for 'Currently supported type conversions'. -- Martijn Pieters, Web Developer | Antraciet http://www.antraciet.nl | Tel: +31-35-7502100 Fax: +31-35-7502111 | mailto:mj@antraciet.nl http://www.antraciet.nl/~mj | PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149 ------------------------------------------
participants (6)
-
Johan Carlsson -
Martijn Pieters -
Michel Pelletier -
Morten W. Petersen -
Rik Hoekstra -
Rik Hoekstra