Re: checkbox validation prob

"Chris Cioffi" <[email protected]>
Newsgroups gmane.comp.python.formencode
Message-ID <[email protected]>
On 4/12/07, alain@free <[email protected]> wrote:
> hello
> i have a checkbox prob
> i would like to give a custom message when a cb is not checked
> this fails:
> tos = validators.NotEmpty(messages={'empty': 'I am empty'})
> and the message i get is " Missing value"
> from what i read this is expected as a default from Schema
> when a field does not exists
> when i try to give a default  val as ''
>  tos = validators.NotEmpty(if_missing='' , messages={'empty': 'I am empty'})
> i dont get much succes and it is no more considered as empty
> so what can i do to get my message for an unchecked cb
> thanks

I'm guessing that you've got something like a "I have read and agree
to the TOS" and you want to require the checkbox to be checked before
you complete the action.

You probably need to check out the Schema validation instead of just
validating on that one form field.

Chris
-- 
"A little government and a little luck are necessary in life, but only
a fool trusts either of them." -- P. J. O'Rourke

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.