Radio button name

Thread Solved

Join Date: Jun 2009
Posts: 22
Reputation: CoSIS1 is an unknown quantity at this point 
Solved Threads: 1
CoSIS1 CoSIS1 is offline Offline
Newbie Poster

Radio button name

 
0
  #1
Jul 20th, 2009
Hi everyone;
I’ve written the following for some purpose :

  1. <%
  2. Vector v1,v2;
  3. String sql;
  4. String sqlvsp;
  5.  
  6.  
  7. sqlvsp= "select distinct(question_text) from question where type = 'UStudent' ";
  8.  
  9.  
  10. Vector vc=database.jdbcOneRowQuery(sqlvsp);
  11. for(int n=0;n<vc.size();n++){
  12.  
  13.  
  14. %>
  15.  
  16. <table border="0" width="100%">
  17. <tr>
  18. <td colspan="6"><font size="2"><b><% out.print(n+1); %>)<% out.print(vc.get(n)); %></b></font>
  19.  
  20. </td>
  21. </tr>
  22.  
  23. <tr>
  24. <td></td>
  25. <td align="center" width="16%"><font size="2"><b>Very satisfied</b></font></td>
  26. <td align="center" width="16%"><font size="2"><b>Satisfied</b></font></td>
  27. <td align="center" width="16%"><font size="2"><b>Neither</b></font></td>
  28. <td align="center" width="16%"><font size="2"><b>Dissatisfied</b></font></td>
  29. <td align="center" width="16%"><font size="2"><b>Very dissatisfied</b></font></td>
  30.  
  31. </tr>
  32. <%
  33.  
  34. sql = "select option from question where type = 'UStudent' AND question_text = '"+vc.get(n)+"' ";
  35.  
  36. v1=database.jdbcMultipleRowQuery(sql );
  37. out.print(v1.size());
  38. String ses="10/11";
  39. session.setAttribute("ses",ses);
  40.  
  41.  
  42. for(int i=0;i<v1.size();i++){
  43. v2 = (Vector)v1.elementAt(i);
  44. for(int j=0;j<v2.size();j++){
  45.  
  46. %>
  47.  
  48. <input type="hidden" name="q<%=i%>" value="<%out.print(""+v2.get(0)+"");%> ">
  49. <tr>
  50.  
  51. <td align="left"><font size="2"><b><%out.print(""+v2.get(j)+"");%>
  52. <td align="center"><font size="2"><b><input name="<%=i%>" value="Very satisfied" type="radio">1.</b></font></td>
  53. <td align="center"><font size="2"><b><input name="<%=i%>" value="Satisfied" type="radio">2.</b></font></td>
  54. <td align="center"><font size="2"><b><input name="<%=i%>" value="Neither" type="radio">3.</b></font></td>
  55. <td align="center"><font size="2"><b><input name="<%=i%>" value="Dissatisfied" type="radio">4.</b></font></td>
  56. <td align="center"><font size="2"><b><input name="<%=i%>" value="Very dissatisfied" type="radio">5.</b></font></td>
  57. </tr>
  58. <%} }
  59. }
  60. %>
  61. </table>
  62. <p align="center" style="text-align: center">
  63.  
  64. <input type="submit" value="Submit">
  65.  
  66. </p>
  67.  
  68. </form><p>
  69.  
  70.  
  71. <%
  72.  
  73. database.jdbcConClose();
  74. database = null;
  75. %>


When I select the options for the first question , it goes smoothly , but when I want to select the options for the second one it would uncheck the options for the first question, and if I select the options for third question , it would uncheck the options for second question, and ….
Is there way that allow me to select the options for each question and it does not effect the others


My regards,
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 4,221
Reputation: peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of 
Solved Threads: 489
Moderator
Featured Poster
peter_budo's Avatar
peter_budo peter_budo is offline Offline
Code tags enforcer

Re: Radio button name

 
-1
  #2
Jul 21st, 2009
You should get back to basics of HTML. Simple example here
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)

LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 22
Reputation: CoSIS1 is an unknown quantity at this point 
Solved Threads: 1
CoSIS1 CoSIS1 is offline Offline
Newbie Poster

Re: Radio button name

 
0
  #3
Jul 21st, 2009
the radio buttons are inside three loops , can anyone take a look on the code and give suggestion ?
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 4,221
Reputation: peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of 
Solved Threads: 489
Moderator
Featured Poster
peter_budo's Avatar
peter_budo peter_budo is offline Offline
Code tags enforcer

Re: Radio button name

 
-1
  #4
Jul 22nd, 2009
The radio buttons that select/deselect have to by member of same group that is declared through name. As you are giving each radio current value of "i" they cannot be grouped.
Simple example
  1. <form>
  2. <input type="radio" name="moderator" value="~s.o.s~" checked="checked"/>~s.o.s~<br />
  3. <input type="radio" name="moderator" value="peter_budo" />peter_budo<br/>
  4. <input type="radio" name="moderator" value="Ezzaral" />Ezzaral<br />
  5. <input type="radio" name="administrator" value="cscgal"/>cscgal<br />
  6. <input type="radio" name="administrator" value="happygeek" checked="checked"/>happygeek
  7. </form>
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)

LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC