durusmail: quixote-users: Getting empty checkboxes from request
Getting empty checkboxes from request
2003-12-18
Re: Getting empty checkboxes from request
2003-12-18
Getting empty checkboxes from request
Neil Schemenauer
2004-01-06
On Thu, Dec 18, 2003 at 09:14:38AM +0100, Thomas Guettler wrote:
> I think you all now the problem:
> You have a checkbox in a form, and you
> don't know if the checkbox set or not, since
> the browser don't send you values for
> unchecked boxes.
>
> request.form.get("mycheckbox")
> will return None in both cases:
>  1. The value was not displayed in
>      the HTML form (the user could not check it)
>  2. The value was displayed and
>     not checked by the user.

You have to know if the checkbox was displayed or not.

> I help me by adding a hidden form element "mycheckbox:savebool"

That's one way of doing it.

  Neil


reply