2011-05-16 31 views
0

您好,我創建了一個表的表列的一個是一個複選框和其他數據 現在我知道我可以使用複選框後一個值BT我怎麼能發送整個排 即當用戶選中複選框的ID,標題,描述....... REQ量被貼到checkbox被選中,並根據該過程中的所有在servlet檢查這個servlet使用複選框以發送多個值

<table border="1" cellpadding="6" cellspacing="4" 
     style="border-collapse: collapse" width="200%" id="AutoNumber1" 
     align="center" bordercolorlight="#800000" bordercolordark="#800000 " class="left" > 
    <tr> 
     <td width="5%" align="center"> 
      <input type="checkbox" id=checked" value=<%= id%>/> 
      <font face="Arial" size="3" color="light blue"> 
      Options</font> 
     </td> 
     <td width="15%" align="center"> 
     <font face="Arial" size="3" color="light blue"> 
      Title</font> 
     </td> 
     <td width="40%" align="center"> 
     <font face="Arial" size="3" color="light blue"> 
      Description</font> 
     </td> 

       <td width="15%" align="center"> 
     <font face="Arial" size="3" color="light blue"> 
      Company</font> 
     </td> 
     <td width="10%" align="center"> 
     <font face="Arial" size="3" color="light blue"> 
      Province</font> 
     </td> 
      <td width="10%" align="center"> 
     <font face="Arial" size="3" color="light blue"> 
      District</font> 
     </td> 
      <td width="10%" align="center"> 
     <font face="Arial" size="3" color="light blue"> 
      Actual Quantity</font> 
       </td> 
     <td width="10%" align="center"> 
     <font face="Arial" size="3" color="light blue"> 
      Required Quantity</font> 

     </td> 
    </tr> 
</table> 
+0

你的問題我也不清楚 – 2011-05-16 06:23:30

+0

@Jigar:據我瞭解OP要提交其複選框被選中整行的數據。 – 2011-05-16 06:26:59

+0

@ahsan如果@Harry是正確的,那麼封裝的形式一切並處理該複選框被選中的行。 – 2011-05-16 06:29:10

回答

0

其他數據。 e.g,如果你的HTML看起來像這樣:

<table border="1" cellpadding="6" cellspacing="4" 
     style="border-collapse: collapse" width="200%" id="AutoNumber1" 
     align="center" bordercolorlight="#800000" bordercolordark="#800000 " class="left" > 
    <tr> 
     <td width="5%" align="center"> 
      <input type="checkbox" id="checkbox_1" value=<%= id%>/> 
      <font face="Arial" size="3" color="light blue"> 
      Options1</font> 
     </td> 
     <td width="15%" align="center"> 
     <font face="Arial" size="3" color="light blue"> 
      Title</font><input id="title_1" /> 
     </td> 
     <td width="40%" align="center"> 
     <font face="Arial" size="3" color="light blue"> 
      Description</font><input id="description_1" /> 
     </td> 

    </tr> 
     <tr> 
     <td width="5%" align="center"> 
      <input type="checkbox" id="checkbox_2" value=<%= id%>/> 
      <font face="Arial" size="3" color="light blue"> 
      Options2</font> 
     </td> 
     <td width="15%" align="center"> 
     <font face="Arial" size="3" color="light blue"> 
      Title</font><input id="title_2" /> 
     </td> 
     <td width="40%" align="center"> 
     <font face="Arial" size="3" color="light blue"> 
      Description</font><input id="description_2" /> 
     </td> 

    </tr> 
</table> 

比你的servlet,檢查是否checkbox_1選擇?如果是,則進程title_1description_1。並應用相同的邏輯checkbox_2title_2 & description_2

+0

的問題是,整個表被從數據庫填充,我使用JSON打印的HTML頁面上,因此是完全動態的,我不認爲上述shceme將適合 – ahsan 2011-05-16 07:13:41

+0

如果我不使用此ID '複選框[ID]' 的ID和複選框[ID] [名]爲標題,將工作 – ahsan 2011-05-16 09:16:20

+0

@ahsan,這就是偉大的。我只是提出了一個非常基本的想法。您必須根據您的要求調整它。 – 2011-05-16 09:20:23