By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,908 Members | 1,892 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,908 IT Pros & Developers. It's quick & easy.

How to return a matrix of checkbox from client to server side?

P: 17
Dear Python experts:
I am trying to use Cherrypy to do one web application. I used the cheetah template to generate the HTML file for a matrix of checkbox, and hope to return the checked checkbox information to server side. Because I already used the form for quick selection, and HTML doesn't support nested form. Could you please point me to right way to get the checked checkbox information to server side for handling?
Following is the HTML code generated by cheetah and you can save as *.html and open with internet browser.
Expand|Select|Wrap|Line Numbers
  1. <HTML>
  2. <HEAD>
  3. <TITLE>TRY</TITLE>
  4.  
  5. <STYLE type="text/css">
  6. body {background-color: "lightyellow";}
  7. </STYLE>
  8.  
  9. </HEAD>
  10. <BODY>
  11.  
  12. <script language=JavaScript>
  13.  
  14. function select_all_onclick() {
  15.    document.SelectSlot1.select_slot1.checked = document.SelectAll.select_all.checked
  16.    document.SelectSlot2.select_slot2.checked = document.SelectAll.select_all.checked
  17.    document.SelectSlot3.select_slot3.checked = document.SelectAll.select_all.checked
  18.    document.SelectBoat1.select_boat1.checked = document.SelectAll.select_all.checked
  19.     document.SelectBoat1Slot1.boat1_slot1.checked = document.SelectAll.select_all.checked
  20.     document.SelectBoat1Slot2.boat1_slot2.checked = document.SelectAll.select_all.checked
  21.     document.SelectBoat1Slot3.boat1_slot3.checked = document.SelectAll.select_all.checked
  22.    document.SelectBoat2.select_boat2.checked = document.SelectAll.select_all.checked
  23.     document.SelectBoat2Slot1.boat2_slot1.checked = document.SelectAll.select_all.checked
  24.     document.SelectBoat2Slot2.boat2_slot2.checked = document.SelectAll.select_all.checked
  25.     document.SelectBoat2Slot3.boat2_slot3.checked = document.SelectAll.select_all.checked
  26.    document.SelectBoat3.select_boat3.checked = document.SelectAll.select_all.checked
  27.     document.SelectBoat3Slot1.boat3_slot1.checked = document.SelectAll.select_all.checked
  28.     document.SelectBoat3Slot2.boat3_slot2.checked = document.SelectAll.select_all.checked
  29.     document.SelectBoat3Slot3.boat3_slot3.checked = document.SelectAll.select_all.checked
  30. }
  31.  
  32. function select_boat1_onclick(){
  33.     document.SelectBoat1Slot1.boat1_slot1.checked = document.SelectBoat1.select_boat1.checked
  34.     document.SelectBoat1Slot2.boat1_slot2.checked = document.SelectBoat1.select_boat1.checked
  35.     document.SelectBoat1Slot3.boat1_slot3.checked = document.SelectBoat1.select_boat1.checked
  36. }
  37. function select_boat2_onclick(){
  38.     document.SelectBoat2Slot1.boat2_slot1.checked = document.SelectBoat2.select_boat2.checked
  39.     document.SelectBoat2Slot2.boat2_slot2.checked = document.SelectBoat2.select_boat2.checked
  40.     document.SelectBoat2Slot3.boat2_slot3.checked = document.SelectBoat2.select_boat2.checked
  41. }
  42. function select_boat3_onclick(){
  43.     document.SelectBoat3Slot1.boat3_slot1.checked = document.SelectBoat3.select_boat3.checked
  44.     document.SelectBoat3Slot2.boat3_slot2.checked = document.SelectBoat3.select_boat3.checked
  45.     document.SelectBoat3Slot3.boat3_slot3.checked = document.SelectBoat3.select_boat3.checked
  46. }
  47.  
  48. function select_slot1_onclick(){
  49.     document.SelectBoat1Slot1.boat1_slot1.checked = document.SelectSlot1.select_slot1.checked
  50.     document.SelectBoat2Slot1.boat2_slot1.checked = document.SelectSlot1.select_slot1.checked
  51.     document.SelectBoat3Slot1.boat3_slot1.checked = document.SelectSlot1.select_slot1.checked
  52. }
  53. function select_slot2_onclick(){
  54.     document.SelectBoat1Slot2.boat1_slot2.checked = document.SelectSlot2.select_slot2.checked
  55.     document.SelectBoat2Slot2.boat2_slot2.checked = document.SelectSlot2.select_slot2.checked
  56.     document.SelectBoat3Slot2.boat3_slot2.checked = document.SelectSlot2.select_slot2.checked
  57. }
  58. function select_slot3_onclick(){
  59.     document.SelectBoat1Slot3.boat1_slot3.checked = document.SelectSlot3.select_slot3.checked
  60.     document.SelectBoat2Slot3.boat2_slot3.checked = document.SelectSlot3.select_slot3.checked
  61.     document.SelectBoat3Slot3.boat3_slot3.checked = document.SelectSlot3.select_slot3.checked
  62. }
  63.  
  64.  
  65. </script>      
  66.  
  67.  
  68. <table border="1" align = "center" bgcolor = "lightblue">
  69. <thead>
  70. <TR>
  71.   <TD width=150 align = "center">
  72.   <form name = SelectAll method="POST">
  73.  
  74.   <label>ALL Boats_Slots<input name = "select_all" type = "checkbox" value = "select_all" onclick = "select_all_onclick()"></label>
  75.   </form>
  76.   </TD>
  77.   <TD width=150 align = "center">
  78.   <form name = SelectBoat1 method="POST">
  79.   <label>657762<input name = "select_boat1" type = "checkbox" value = "select_boat1" onclick = "select_boat1_onclick()"></label>
  80.   </form>
  81.   </TD>
  82.  
  83.   <TD width=150 align = "center">
  84.   <form name = SelectBoat2 method="POST">
  85.   <label>657770<input name = "select_boat2" type = "checkbox" value = "select_boat2" onclick = "select_boat2_onclick()"></label>
  86.   </form>
  87.   </TD>
  88.   <TD width=150 align = "center">
  89.   <form name = SelectBoat3 method="POST">
  90.   <label>657775<input name = "select_boat3" type = "checkbox" value = "select_boat3" onclick = "select_boat3_onclick()"></label>
  91.  
  92.   </form>
  93.   </TD>
  94. </TR>
  95. </thead>
  96. <tbody>
  97. <TR>
  98.  <form name = SelectSlot1 method="POST">
  99.  <TD width=150 align = "center"><label>Slot_1<input name = "select_slot1" type = "checkbox" value = "select_slot1" onclick = "select_slot1_onclick()"></label></TD>
  100.  </form>
  101.  <form name = SelectBoat1Slot1 method="POST">
  102.  
  103.  <TD width=150 align = "center"><label><input name = "boat1_slot1" type = "checkbox" value = boat1_slot1></label></TD>
  104.  </form>
  105.  <form name = SelectBoat2Slot1 method="POST">
  106.  <TD width=150 align = "center"><label><input name = "boat2_slot1" type = "checkbox" value = boat2_slot1></label></TD>
  107.  </form>
  108.  <form name = SelectBoat3Slot1 method="POST">
  109.  <TD width=150 align = "center"><label><input name = "boat3_slot1" type = "checkbox" value = boat3_slot1></label></TD>
  110.  </form>
  111. </TR>
  112.  
  113. <TR>
  114.  <form name = SelectSlot2 method="POST">
  115.  <TD width=150 align = "center"><label>Slot_2<input name = "select_slot2" type = "checkbox" value = "select_slot2" onclick = "select_slot2_onclick()"></label></TD>
  116.  </form>
  117.  <form name = SelectBoat1Slot2 method="POST">
  118.  <TD width=150 align = "center"><label><input name = "boat1_slot2" type = "checkbox" value = boat1_slot2></label></TD>
  119.  </form>
  120.  <form name = SelectBoat2Slot2 method="POST">
  121.  <TD width=150 align = "center"><label><input name = "boat2_slot2" type = "checkbox" value = boat2_slot2></label></TD>
  122.  
  123.  </form>
  124.  <form name = SelectBoat3Slot2 method="POST">
  125.  <TD width=150 align = "center"><label><input name = "boat3_slot2" type = "checkbox" value = boat3_slot2></label></TD>
  126.  </form>
  127. </TR>
  128. <TR>
  129.  <form name = SelectSlot3 method="POST">
  130.  <TD width=150 align = "center"><label>Slot_3<input name = "select_slot3" type = "checkbox" value = "select_slot3" onclick = "select_slot3_onclick()"></label></TD>
  131.  </form>
  132.  
  133.  <form name = SelectBoat1Slot3 method="POST">
  134.  <TD width=150 align = "center"><label><input name = "boat1_slot3" type = "checkbox" value = boat1_slot3></label></TD>
  135.  </form>
  136.  <form name = SelectBoat2Slot3 method="POST">
  137.  <TD width=150 align = "center"><label><input name = "boat2_slot3" type = "checkbox" value = boat2_slot3></label></TD>
  138.  </form>
  139.  <form name = SelectBoat3Slot3 method="POST">
  140.  <TD width=150 align = "center"><label><input name = "boat3_slot3" type = "checkbox" value = boat3_slot3></label></TD>
  141.  </form>
  142.  
  143. </TR>
  144. </tbody>
  145. </table>
  146.  
  147. </BODY>
  148. </HTML>
  149.  
Thank you very much in advance!
Best Regards,
Haiyan
Sep 21 '10 #1
Share this Question
Share on Google+
3 Replies


P: 17
I figured out. I can send the checked checkbox to server side if I only use one form.
Sep 22 '10 #2

bvdet
Expert Mod 2.5K+
P: 2,851
I am glad you were able to figure it out. I would have responded if I knew the answer. :) BV
Sep 22 '10 #3

P: 17
Hi, Bvdet:

Thanks a lot!

Haiyan
Sep 23 '10 #4

Post your reply

Sign in to post your reply or Sign up for a free account.