开发者

using check box to send multiple values

开发者 https://www.devze.com 2023-03-06 08:09 出处:网络
hi i have created a table one of the table columns is a check box and other data now i know how i can post a single value with a check box bt how can i send an entire row

hi i have created a table one of the table columns is a check box and other data now i know how i can post a single value with a check box bt how can i send an entire row i.e. when the user checks the check box id,title,description.......req quantity gets posted to the 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 wid开发者_开发技巧th="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>


in your servlet check which checkbox are selected and depending upon that process all other data. e.g, if your HTML looks like this:

<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>

than in your servlet, check whether checkbox_1 is selected? if yes than process title_1 and description_1. And apply same logic for checkbox_2, title_2 & description_2

0

精彩评论

暂无评论...
验证码 换一张
取 消