Re: Checkboxes

Ian Bicking <[email protected]>
Newsgroups gmane.comp.python.formencode
Message-ID <[email protected]>
Mike Orr wrote:
> On Jan 29, 2008 9:25 PM, A Monkey <[email protected]> wrote:
>> I don't use htmlfill to
>> pre-populate my forms, and I'd recommend against it to anyone that
>> asked. I use my templating language. htmlfill is super-useful for
>> redrawing forms after failed validation, but it always felt like it
>> was more work to use htmlfill to pre-populate than it was worth.
> 
> Well, prepopulating it ensures that the same method is used to set the
> initial values as the error values, so that if one is reliable you can
> assume the other will be too.  It also avoids having to put
> 'value="${c.fieldname | h}"' all over the template, which lets the
> other placeholders and variables stand out more.

More generally, I think this is an unresolvable problem that 
round-tripping through FormEncode involves normalization of values, and 
that normalization doesn't always make sense to htmlfill.

Generally if you have a true boolean checkbox, I'd just leave off the 
value entirely (I think it defaults to "on"?).  I think that should 
work, and if not that should be fixed in htmlfill.

   Ian

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
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.