You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Metehan Selvi <ms...@innuendo.de> on 2001/08/09 16:56:42 UTC

Radio-Button Tag

Hi,
one question about Radio-Input Fields, which are implemented by the RadioTag-class:
How to set an 'element' as checked e.g. as a default value?
I haven't found a hint or an property for the radio-field, where i can set the property checked=true or something like that.

cheers
mete

Re: Radio-Button Tag

Posted by Ted Husted <hu...@apache.org>.
It's automagical. If you set the property in the ActionForm to the
property for a given Radio Button, the button turns itself on. Almost
like a listener.

So, your ActionForm might do this

        this.priceLevel = "0";

And your JSP may say this

<html:radio property="priceLevel" value="0"/>$2,500 and under<br>
<html:radio property="priceLevel" value="1"/>$2,500-$7,500<br>
<html:radio property="priceLevel" value="2"/>$7,500-$10,000<br>
<html:radio property="priceLevel" value="3"/>$10,000+   

which would turn the first button in this list on by default.

-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Custom Software ~ Technical Services.
-- Tel +1 716 737-3463
-- http://www.husted.com/about/struts/


> Metehan Selvi wrote:
> 
> Hi,
> one question about Radio-Input Fields, which are implemented by the
> RadioTag-class:
> How to set an 'element' as checked e.g. as a default value?
> I haven't found a hint or an property for the radio-field, where i can
> set the property checked=true or something like that.
> 
> cheers
> mete