On 12/27/05, Jeremy Jones <[EMAIL PROTECTED]> wrote:
>
> Dan Jacob wrote:
> > Sorry, explanation required:
> > The code compares the "value" attribute of the widget with the input
> > value. As the input value is None, and you have not specified the
> > attribute value, this is also None. Therefore the "checked" attribute
> > is inserted. The Bool validator returns True or False, neither of which
> > equal None and therefore the attribute "checked" is missing. Therefore
> > always set the "value" attribute to an explicit value.
> >
> > I know this is not clear or documented, and it would be better to have
> > a "value" argument in the constructor or somesuch.
> >
> Looks like it's working as it's supposed to, then. Given the following
> widgets:
>
> > widgets.CheckBox(name="some_checkbox", labeltext="Some Checkbox",
> > validator=validators.Bool(), attrs={"value": 1}),
> > widgets.CheckBox(name="some_other_checkbox", labeltext="Some Other
> > Checkbox", validator=validators.Bool())
>
> "some_checkbox" defaults to not checked, whereas "some_other_checkbox"
> defaults to checked. "some_checkbox" holds a check (when you actually
> check it) and "some_other_checkbox" won't hold a check. Specifying a
> default (having my cake) and getting it to keep the value (eating it
> too) would be great.
I don't think it's working "as it's supposed to", because I think what
you're suggesting should be the default behavior. You should not need
to specify attrs (or even the validator) and you should be able to
give a default of True (or not) and have the right thing happen with
the incoming value. At least, that's how I'd want a checkbox to
work...
Kevin
--
Kevin Dangoor
Author of the Zesty News RSS newsreader
email: [EMAIL PROTECTED]
company: http://www.BlazingThings.com
blog: http://www.BlueSkyOnMars.com