Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Radio Buttons with selected option

Status
Not open for further replies.

chrisw09

IS-IT--Management
Nov 23, 2005
22
US
I'm trying to setup radio buttons in struts and need a default button checked. I'm using the format:

Code:
<input type="radio" name="color" value="blue" checked="checked">

But I'm getting the following:
Attribute checked invalid for tag radio according to TLD.

I'm using Struts 1.2.7 but tried 1.2.9 also and neither seem to work. I see other posts referencing the checked="checked" attribute but i just don't see it.

Am i missing something or am i just blind...
 
<input type="radio"..." is not a struts directive.

"<html:radio..." would be the proper tag to use.

checked="checked" does work from an HTML perspective and that's what Struts will build if the value from one of your radio buttons matches the corresponding property in your ActionForm class.

-G
 
sorry, i posted the wrong code snippet:

this is what i'm doing

Code:
<html:radio property="transType" value="SO" checked="checked"/>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top