Solved

Clickable radio button labels for Struts

Posted on 2007-04-03
3
855 Views
Last Modified: 2013-11-24
I have a Struts application with a form that has a radio button group.  A typical radio button on this form looks like this:

<html:radio property="CITY" value="New York"> New York</html:radio>


I'd like to make the label for the radio button clickable, however the Struts API does not allow setting an ID for <html:radio> tag.  Has anyone been able to get this to work in their Struts app?  Here is an example how non-Struts apps would create a clickable label:

<input type="radio" id="male" name="gender" />
<label for="male">Male</label>
0
Comment
Question by:nateforrest1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 19

Accepted Solution

by:
Kuldeepchaturvedi earned 500 total points
ID: 18847888
have a look at this..
This might help.
http://www.beernut.ca/jim/archives/002408.html
0
 

Author Comment

by:nateforrest1
ID: 18848237
Thanks!  Although the page you referred me to went to extremes that were not necessary for my application, I was reminded of the 'styleId' attribute for the tag.  

Here is what worked for me:

<html:radio styleId="chicago" property="CITY" value="Chicago"><label for="chicago">Chicago</label></html:radio>
0
 
LVL 19

Expert Comment

by:Kuldeepchaturvedi
ID: 18848335
yup! I thought that it will work.. but I was not too sure... as I am not very good at struts..

but I am glad that it worked for u.
0

Featured Post

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…

735 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question