You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Cliff Lam <cl...@reinfo.com.hk> on 2005/05/03 04:20:21 UTC

Re: problem with checkbox values and map backed properties

You can try to set a "unlicked value" in the reset function in the form.

When the click-box is clicked the unlicked value will be covered.

Hope this is useful for you. =)

Cliff

----- Original Message ----- 
From: "Günther Wieser" <gw...@exa-online.de>
To: "'Struts Users Mailing List'" <us...@struts.apache.org>
Sent: Saturday, April 30, 2005 1:28 AM
Subject: problem with checkbox values and map backed properties


> hi,
>
> i have the following problem with map backed properties:
>
> i created a form bean with a map called inCampaignMap, and the getter and
> setters being "boolean getInCampaign(String key)" and
"setInCampaign(String
> key, boolean value)". internally, of course, the map value entries are of
> type Boolean.
>
> in my JSP i have the following code:
> <html:checkbox property="inCampaign(${campaign.id})" />
> where ${campaign.id} indicates the key for the map.
>
> this works fine if the checkbox is checked. in this case i can see that
the
> setInCampaign() method is being called and that i get "true" for the
value.
>
> if the checkbox is unchecked, the value is NOT set.
>
> strange enough, i also can see from the html code that's generate that
> "value="on"" is always set, no matter if the checkbox is checked or not.
>
> any ideas?
>
> thanks in advance, kr,
> guenther
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: problem with checkbox values and map backed properties

Posted by Günther Wieser <gw...@creative-it.com>.
hi,

thanks, already solved, problem is that the map is (of course) fille up
dynamically, and putting the code to reload it into the reset function is
not possible, as the list depends on one of the other properties of the
form.

now i just say "if there's no property in the map, it's unset".

kr,
guenther


--
Günther Wieser

creative-it
Guglgasse 6/1/11/1
A-1110 Wien
Austria
http://www.creative-it.com


-----Original Message-----
From: Cliff Lam [mailto:cliff@reinfo.com.hk] 
Sent: Tuesday, May 03, 2005 4:20 AM
To: Struts Users Mailing List
Subject: Re: problem with checkbox values and map backed properties

You can try to set a "unlicked value" in the reset function in the form.

When the click-box is clicked the unlicked value will be covered.

Hope this is useful for you. =)

Cliff

----- Original Message -----
From: "Günther Wieser" <gw...@exa-online.de>
To: "'Struts Users Mailing List'" <us...@struts.apache.org>
Sent: Saturday, April 30, 2005 1:28 AM
Subject: problem with checkbox values and map backed properties


> hi,
>
> i have the following problem with map backed properties:
>
> i created a form bean with a map called inCampaignMap, and the getter and
> setters being "boolean getInCampaign(String key)" and
"setInCampaign(String
> key, boolean value)". internally, of course, the map value entries are of
> type Boolean.
>
> in my JSP i have the following code:
> <html:checkbox property="inCampaign(${campaign.id})" />
> where ${campaign.id} indicates the key for the map.
>
> this works fine if the checkbox is checked. in this case i can see that
the
> setInCampaign() method is being called and that i get "true" for the
value.
>
> if the checkbox is unchecked, the value is NOT set.
>
> strange enough, i also can see from the html code that's generate that
> "value="on"" is always set, no matter if the checkbox is checked or not.
>
> any ideas?
>
> thanks in advance, kr,
> guenther
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org