Thanks Ted. So if I want to keep the checkbox metaphor (rather than use a radio button, which might confuse the UI), I should use an image of a checkbox (in either of it's states). Yes?
Is there an obvious way to derive a mapping between the Form bean and the image on the JSP? Thanks for your help. -Chris > -----Original Message----- > From: Ted Husted [mailto:[EMAIL PROTECTED]] > Sent: Saturday, February 23, 2002 4:32 PM > To: Struts Users Mailing List > Subject: Re: Checkbox state not changing after "checked on" > > > The underlying problem is that the HTML spec tells the browsers to not > submit a checkbox if it is not checked. (Or any other blank control for > that matter.) There's not a lot we can do about that =:o( > > What happens with a box that starts out checked, is that when it is > unchecked, nothing is submitted. If the box represents a persistent > state, it just stays checked, since nothing turned it off. > > Some times a radio button is a better way to go, since something will > always be submitted. > > The reset method grew out of a need to set the checkboxes to a known > state, to get around this quirk of HTML. > > The alternative is to scan the request for the missing checkboxes, and > set them as expected if they are missing. > > -- Ted Husted, Husted dot Com, Fairport NY US > -- Developing Java Web Applications with Struts > -- Tel: +1 585 737-3463 > -- Web: http://husted.com/about/services > > Chris Means wrote: > > > > I'm having a problem with setting check box states on my form. > > > > I have a checkbox on my form, it's supposed to be "checked" if muting is > > occurring, and not checked otherwise. > > > > The user just needs to click the checkbox to change/toggle the state. > > > > However, I only seem to get an Action setting if the checkbox is not > > checked...any ideas what I'm doing wrong? Shouldn't the property be set > > regardless of the state of the object? > > > > My JSP: > > > > <html:checkbox property="mute" > > onclick="this.form.submit ()" />Mute > > > > My FormBean: > > > > public void setMute (boolean newMute) > > { > > mute = newMute ; > > action = "mute" ; > > } > > > > My ActionForm: > > > > ControlPanelForm cp = (ControlPanelForm) form ; > > > > String action = cp.getAction () ; > > > > System.out.println ("Action: " + action) ; > > > > if ("mute".equals (action)) > > api.mute () ; > > > > status.refresh () ; > > > > cp.setMute (status.isMuted ()) ; > > > > return (mapping.findForward ("success")); > > > > TIA. > > > > -Chris > > > > -- > > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>