Fwd: Help: ensuring that a checkbox is checked
"Vijay Ramachandran" <[email protected]> Thu, 13 Nov 2008 23:09:10 +0530
| Newsgroups | gmane.comp.python.formencode |
|---|---|
| Message-ID | <[email protected]> |
Sorry, got the wrong "To" ---------- Forwarded message ---------- From: Vijay Ramachandran <[email protected]> Date: Thu, Nov 13, 2008 at 11:08 PM Subject: Re: [FE-discuss] Help: ensuring that a checkbox is checked To: Ian Bicking <[email protected]> Thanks. On Thu, Nov 13, 2008 at 10:46 PM, Ian Bicking <[email protected]> wrote: > > A little overly minimal, but you can do: > > class MySchema(Schema): > tac_agree = String() > > Since the checkbox will be missing from the input if it's not checked, so > the lack of an if_missing in the validator should get it to trigger. Maybe > a better way would be: > > class MySchema(Schema): > tac_agree = OneOf(['1']) > For whatever reason, neither of these work. I am particularly stumped that OneOf doesn't work. I'm using FormEncode 0.7.1 with python 2.5, if that helps to make sense of it. Since there are other mandatory fields in the form, I'm hacking the required-nes by using a validators.RequireIfPresent() with chained validators. That works. thanks, Vijay ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ FormEncode-discuss mailing list FormEncode-discuss-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org https://lists.sourceforge.net/lists/listinfo/formencode-discuss