[Zope] HTML forms: how to get the value of an unchecked checkbox?

Stephane Bortzmeyer bortzmeyer@netaktiv.com
Mon, 7 May 2001 16:19:47 +0200

On Mon, May 07, 2001 at 04:08:47PM +0200,
 Tino Wildenhain <tino@wildenhain.de> wrote 
 a message of 64 lines which said:

> one solution is to let zope handle this. Include
> the following into your form:
> <input type="hidden" name="sugar:default" value="no">

It works, thanks a lot. Where is it documented? ":default" is
mentioned in Chapter 8 "Advanced Zope Scripting" of the Zope Book,
but, even now I know the trick, I cannot find it in the book.

My final solution, with conversion to boolean:

<INPUT TYPE="checkbox" NAME="milk:boolean">Milk?<BR> 
<INPUT type="hidden" name="milk:default" value="">

and the script:


if milk:
	milk = " with milk"
	milk = ""
return "<P>You asked " + beverage + sugar + milk