You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Michael Hackett <mh...@pictorius.com> on 2001/02/27 16:17:44 UTC

CheckboxTag value problem

Hi -- newcomer to the list here...

I was trying to figure out why my checkboxes were always enabled
initially, and discovered that the code for the CheckboxTag class does
not match the description in the HTML Tag Reference. Specifically, the
value attribute is supposed to give the value submitted when the
checkbox is checked, but instead all it does is override the form bean
property as the initial state.

I didn't see that behaviour elsewhere, and multibox seems to match up
with the description, so I think the current version is a bug. I've
fixed up the checkbox code (using MultiboxTag as a guide), which I can
pass on (or post here) to anyone who wants to take a look and possibly
incorporate it.

I did see Laine Donlan's recent post about his changes, and I think the
idea of using the value field contents as the initial value to match is
a good one. I don't need that right now (my checkboxes are just mapped
to boolean fields), but it would be an easy addition and would make a
lot of sense.

I don't, however, see why some people are complaining about not getting
values from unchecked checkboxes, as that seems to be sufficiently
handled by the reset() method functionality, isn't it? Or am I missing
something?

In addition, the HTML 4.01 spec says that value is not an optional field
for a checkbox, so the checkbox taglet should be generating something
for this field, even if no value parameter is given (or make value
required for the custom tag as well).

(BTW, should I submit this into bugzilla, even though I've got a
solution already?)
--
Michael Hackett
Developer, Pictorius Inc.


Re: CheckboxTag value problem

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
Michael Hackett wrote:

> Hi -- newcomer to the list here...
>
> I was trying to figure out why my checkboxes were always enabled
> initially, and discovered that the code for the CheckboxTag class does
> not match the description in the HTML Tag Reference. Specifically, the
> value attribute is supposed to give the value submitted when the
> checkbox is checked, but instead all it does is override the form bean
> property as the initial state.
>
> I didn't see that behaviour elsewhere, and multibox seems to match up
> with the description, so I think the current version is a bug. I've
> fixed up the checkbox code (using MultiboxTag as a guide), which I can
> pass on (or post here) to anyone who wants to take a look and possibly
> incorporate it.
>
> I did see Laine Donlan's recent post about his changes, and I think the
> idea of using the value field contents as the initial value to match is
> a good one. I don't need that right now (my checkboxes are just mapped
> to boolean fields), but it would be an easy addition and would make a
> lot of sense.
>
> I don't, however, see why some people are complaining about not getting
> values from unchecked checkboxes, as that seems to be sufficiently
> handled by the reset() method functionality, isn't it? Or am I missing
> something?
>
> In addition, the HTML 4.01 spec says that value is not an optional field
> for a checkbox, so the checkbox taglet should be generating something
> for this field, even if no value parameter is given (or make value
> required for the custom tag as well).
>
> (BTW, should I submit this into bugzilla, even though I've got a
> solution already?)
>

I would appreciate it if you would ... patches in the mailing lists
sometimes get lost in my inbox :-(, but I always run current queries to see
which bug reports haven't been addressed yet.

You can include your proposed patch by adding an attachment to the bug
report.

> --
> Michael Hackett
> Developer, Pictorius Inc.

Craig