[Zope] Passing the value of a checkbox from a form to a dtml-method

Tim Cook tim@freepm.org
Tue, 01 May 2001 08:17:20 -0500


Gitte Wange wrote:
> 
> Hello,
> 
> I have a problem doing <subject>
> I have added a checkbox in a form, but when the submit button is hitted, the
> value of the checkbox isn't passed along to the receiving method.
> The checkbox code looks like this:
> <INPUT TYPE="checkbox" NAME="isPublic">
> 
> Pretty normal I would say .. but perhaps someone out there have had my
> problem ?
> 

I don't know exactly what problem you're having, but my guess is
this will solve it.

With checkboxes, the variable name does not exist in the REQUEST
space unless the box is checked.
So:

<dtml-if isPublic>
  ...do some stuff...
<dtml-else>
  ...do other stuff...
</dtml-if>

Put this little method in your root folder and use it as an
action in your forms to help troubleshoot these issues (and other
REQUEST problems).

--- show_request DTML Method-------
<dtml-var standard_html_header>
<dtml-var REQUEST>
<dtml-var standard_html_footer>
----------------------------------

HTH,
-- 
Tim Cook, President - FreePM,Inc. 
http://www.FreePM.com Office: (731) 884-4126
ONLINE DEMO: http://www.freepm.org:8080/FreePM