JQuery - submit page containing multiple forms
<p>I have a java/jsp application using custom framework on the server side.  This particular page is the view shopping cart that has a list of the items in the cart. In the list i have a form for each item to update qty or remove the item. I am using the multiple forms so i don't have to do as much work on the server side to figure out which item needs to be updated if I were to submit the entire list in one form.  I give each form the unique id of the product and i also add the same id to an attribute on the action link that triggers the submit.  On the click of action link I need to set the hidden field pageAction so on the server side this corresponds to an actionEvent that runs code for any specific page action.  So if cartUpdate was hit that need to be set to pageAction.  The below code works but I am just not sure if there is any bad practice in this as i primary stick to server side code ;)  i was mostly questioning the line in the js code:</p>

<pre><code> js("input[rel=actionButton]").val(action);
</code></pre>

<p>I am not sure if i also need to do a check that is is coming from the proper form by id?
Or if there is just a way better way to do this on the JS side then what i am doing.  Any advice would be appreciated.</p>

<p><strong>HTML</strong></p>

<pre><code>&lt;!-- QUANTITY AND MANAGEMENT --&gt;
&lt;td class="cartQty" align="left" valign="top"&gt;
    &lt;form id="${item.product.boId}" action="${pageContext.request.contextPath}/store/viewcart.do" method="post"&gt;
        &lt;input name="quantity" type="text" value="1" maxlength="3" class="cartQtyBox"&gt;  
        &lt;input type="hidden" value="${item.product.boId}" name="productId"&gt;
        &lt;input type="hidden" value="${item.productStyle.boId}" name="productStyleId"&gt;
        &lt;input type="hidden" name="pageAction" rel="actionButton"&gt;
        &lt;a id="buttonAction" rel="buttonAction" action="cartUpdate" pid="${item.product.boId}" href="#" class="updateCart"&gt;Update&lt;/a&gt;
        &lt;span&gt;|&lt;/span&gt;
        &lt;a id="buttonAction" rel="buttonAction" action="cartRemove" pid="${item.product.boId}" href="#" class="removeItem"&gt;Remove&lt;/a&gt;
    &lt;/form&gt;
&lt;/td&gt;
</code></pre>

<p><strong>JS</strong></p>

<pre><code>js(document).ready(function() {
    js("a[rel=buttonAction]").click(function(event){
        var formId = js(this).attr('pid');
        var action = js(this).attr('action');
        js("input[rel=actionButton]").val(action);
        js("#"+formId).submit();
    });
});
</code></pre>
