That's not really a bug.  In a browser, if a checkbox is not checked,
it isn't sent in the request (see 
http://www.w3.org/TR/html401/interact/forms.html#h-17.2.1)
The form validator uses basic input for validation, so checkboxes
won't be there if they are not checked.

If you want to always have the value of a checkbox in a webpy form,
you can use the "d" attribute like this:

myform = Form(
    Checkbox('foo')
)

def POST(self):
    f = myform()
    if not f.validates():
        ...
    if f.d.foo: # this will be 'None' if it wasn't checked on the page
        ...


Cheers,
Justin
On Apr 25, 7:27 pm, Jo <[email protected]> wrote:
> Hello,
>
> There appears to be a bug with multiple field validators and
> checkboxes of fom.py. The validator can't access the checkbox value
> ( e.g. lambda i: i.my_check_box <-- i.my_check_box is not accessible
> instead we have to do i.get('my_check_box', False) )
>
> Jo
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to