You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Daniel Kies <da...@gmail.com> on 2005/02/14 19:21:44 UTC

Radio Button Default Values

I am trying to configure a default value for a radio button as done by
Ted Husted on - http://www.jguru.com/faq/view.jsp?EID=1028442

My action has:
		ArrayList shippers = new ArrayList(); 
		  shippers.add(new LabelValueBean("UPS", "UPS")); 
		  shippers.add(new LabelValueBean("Federal Express", "FEDX")); 
		  shippers.add(new LabelValueBean("AirBorne", "AIRB")); 
		request.setAttribute ("SHIPPERS",shippers);
		request.setAttribute ("expectedVia","UPS");

and struts config for this dynaactionform is 
			<form-property name="expectedVia" type="java.lang.String">
			</form-property>

and in the jsp:
<logic:iterate id="row" name="SHIPPERS"> 
  <html:radio property="expectedVia" value="row" /> 
  <bean:write name="row" property="label"/> 
</logic:iterate>

I just can't figure out how to get UPS as the default radio button
selected.  Any suggestions?

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


Re: Radio Button Default Values

Posted by Daniel Kies <da...@gmail.com>.
Worked great, thank you very much.


On Mon, 14 Feb 2005 11:45:00 -0700, Wendy Smoak <ja...@wendysmoak.com> wrote:
> From: "Daniel Kies" <da...@gmail.com>
> > and struts config for this dynaactionform is
> > <form-property name="expectedVia" type="java.lang.String">
> > </form-property>
> >
> > I just can't figure out how to get UPS as the default radio button
> > selected.  Any suggestions?
> 
> Did you try using the 'initial' attribute of the <form-property> tag?
> Example:
>     <form-property  name="acceptTerms"
>                               type="java.lang.String"
>                               initial="N"/>
> 
> --
> Wendy Smoak
> 
> ---------------------------------------------------------------------
> 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


Re: Radio Button Default Values

Posted by Wendy Smoak <ja...@wendysmoak.com>.
From: "Daniel Kies" <da...@gmail.com>
> and struts config for this dynaactionform is 
> <form-property name="expectedVia" type="java.lang.String">
> </form-property>
> 
> I just can't figure out how to get UPS as the default radio button
> selected.  Any suggestions?

Did you try using the 'initial' attribute of the <form-property> tag?
Example:
    <form-property  name="acceptTerms"       
                              type="java.lang.String"
                              initial="N"/>

-- 
Wendy Smoak

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