• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Radio Button Selection

 
Ranch Hand
Posts: 144
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

**


while(rs2.next()){
ansr = rs2.getString("ANSWR_CODE");
v1.addElement(ansr);
}



while(rs.next()){


%>
<tr>
<%
qstn = rs.getString("SRVY_QSTN");
desc = rs.getString("QSTN_DESC");

%>

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

<td width="400">
<%= desc%> </td>
</tr>
<tr>
<td width="700" colspan="2">
<%
for(i=0;i<v1.size();i++){
ob = v1.get(i).toString();
%>
<input name="radio" type="RADIO" value="<%=ob%>">
<EM>
<%
out.print(ob);
}


%>
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Cosmos,
Basically, each group of radio buttons needs to have a different name. Maybe you could use the question id as the radio button name?
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moved to the HTML forum as this really isn't to do with JSP.
 
WARNING! Do not activate jet boots indoors or you will see a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic