Re: How to make sure at least one checkbox is checked?

Ian Bicking <[email protected]> Sun, 07 Sep 2008 11:14:59 -0500
Newsgroups gmane.comp.python.formencode
Message-ID <[email protected]>
Matthew Wilson wrote:
> I've got a list of checkboxes, each with the same name and the value
> attribute is an integer between 1 and 10.
> 
> Right now, I'm converting this to a list like this:
> 
>     from formencode import validators
>     validators.ForEach(validators.Int(), convert_to_list=True)
> 
> I'd like to add another validator to make sure at least one checkbox is
> checked, but I can't figure out how to do that.

I believe it would work to do ForEach(validators.Int(), 
convert_to_list=True, not_empty=True)

-- 
Ian Bicking : [email protected] : http://blog.ianbicking.org

-------------------------------------------------------------------------
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=/