File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes Radio Button Selection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Radio Button Selection" Watch "Radio Button Selection" New topic

Radio Button Selection

Pol Appan
Ranch Hand

Joined: Aug 26, 2004
Posts: 144
I have one dyanamic form with multiple questions and answers, answers are of radio button types.

When user selects thje radio button in one question, the other questions radio button gets deselected. How can I put one radio button group for one question and other radio button for another set of question and so forth.

here is my code.


ansr = rs2.getString("ANSWR_CODE");


qstn = rs.getString("SRVY_QSTN");
desc = rs.getString("QSTN_DESC");


<td width="12">
<%= qstn%>.</td>

<td width="400">
<%= desc%> </td>
<td width="700" colspan="2">
ob = v1.get(i).toString();
<input name="radio" type="RADIO" value="<%=ob%>">


Never take anything for granted because you never know when you will lose it
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 32815

Basically, each group of radio buttons needs to have a different name. Maybe you could use the question id as the radio button name?

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63540

Moved to the HTML forum as this really isn't to do with JSP.

[Asking smart questions] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: Radio Button Selection
It's not a secret anymore!