I have to disagree.  It's perfectly legitimate for a single checkbox to
have a value that's not one of "on", "yes" or "true".
That's legit HTML.  Struts currently (seemingly needlessly) prevents
that usage by only having an annointed set of values, and forcing users
to use those.   I think Franco is correct; I had a similar thought
myself several months back, but didn't take the time to file a bug on
it.

+1 to Franco's proposed change.

Steve

> -----Original Message-----
> From: Karr, David [mailto:david.karr@;attws.com]
> Sent: Tuesday, October 22, 2002 1:11 PM
> To: 'Struts Developers List'
> Subject: RE: [BUGS] CheckboxTag with value property
> 
> 
> > -----Original Message-----
> > From: Franco Caponi [mailto:franco.caponi@;tin.it]
> > Sent: Tuesday, October 22, 2002 12:12 PM
> > 
> > There is a suspicious bug on the CheckboxTag. Infact i can 
> > specify a value
> > that is rendered as  attribute on the INPUT html tag, to 
> overwrite the
> > default "on" value.
> > But if i specify a value, check box is not rendered correctly.
> > 
> > In the doStartTag method, to render the checkbox as checked, 
> > are tested
> > condition for "yes", "true" and "on" values, but not for the "value"
> > instance variable.
> > original code is:
> > 
> > if (checked.equalsIgnoreCase("true")
> >             || checked.equalsIgnoreCase("yes")
> >             || checked.equalsIgnoreCase("on"))
> > results.append(" checked=\"checked\"");
> > 
> > I think that correct code is :
> > 
> > if (checked.equalsIgnoreCase("true")
> >             || checked.equalsIgnoreCase("yes")
> >             || checked.equalsIgnoreCase("on")
> >             || checked.equalsIgnoreCase(this.value))
> > results.append(" checked=\"checked\"");
> 
> Look at the corresponding block of code in 
> "MultiboxTag.java".  I have a
> feeling there isn't a concise statement about this in the 
> documentation, but
> you use "checkbox" if you want to check for boolean values, 
> and you use
> "multibox" if you want to check for "symbols" (can't think of 
> a better way
> to say that).  The other difference is that "checkbox" 
> compares against a
> single value, and "multibox" checks against an array of values.
> 
> --
> To unsubscribe, e-mail:   
<mailto:struts-dev-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail:
<mailto:struts-dev-help@;jakarta.apache.org>


--
To unsubscribe, e-mail:   <mailto:struts-dev-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-dev-help@;jakarta.apache.org>

Reply via email to