javascript - How to submit selected checkbox items? -


i have list of items need selected , take action based on user's request. user selects items , click on 1 of btns on items.

my code following not sure how complete it. believe, need put them in form submitted or pass not sure how have form 2 submit btns, (if need have ).

 <body>         <p><b>shopping cart</b></p>         <table>             <tbody>                 <c:foreach items="${mycart.items}" var="item">                     <tr>                         <td>                             <input type="checkbox" name="items"                                                           value="${item.id}"/>                           </td>                         <td>                            name : ${item.name}                          </td>                     </tr>                 </c:foreach>             </tbody>         </table>         <a href="checkout" onclick="checkout()">checkout</a>         <a href="delete" onclick="delete()">delete</a> 

you can have 2 <input type="submit" name="something" /> in 1 <form> if want differentiate actions, use different name each submit button

edit:

<form ...>    ...    ...    <input id="b1" type="submit" name="edit" value="edit"/>    <input id="b2" type="submit" name="delete" value="delete"/> </form> 

if form above submitted clicking #b1, request contain parameter named "edit". if submit triggered #b2, contain "delete".


Comments

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -