mardi 10 avril 2018

How to dynamically store checkbox value with logic:iterate

Is there any way I can store "invoiceID" (3rd column) to checkbox (1st column) value?

When I select some checkboxes and submit, I want to pass the selected rows' invoice ID.

<html:form action="/affiliates/commission-check-approve" onsubmit="return submitForm(this);" >
    <table width="900" align="center" border="1">

        <b>

        <logic:iterate name="PendingPaymentsList" id="paymentBean"> 

            <bean:define id="invoiceIdBean" name="paymentBean" property="invoiceID"/>
            <% 
                java.util.HashMap paramsInvoiceID = new java.util.HashMap();
                paramsInvoiceID.put("invoiceID", invoiceIdBean);
                pageContext.setAttribute("invoiceIDParams", paramsInvoiceID);
            %>


            <tr>
                <td align="center"><input type="checkbox" name="invoiceIDs[]" value="???" /></td>
                <td align="center"><bean:write name="paymentBean" property="affiliateName"/></td>
                <td align="center"><html:link forward="render-invoice" name="invoiceIDParams" scope="page"><bean:write name="paymentBean" property="invoiceID" /></html:link></td>
                <td align="center"><html:link forward="display-affiliate-payment-form" name="invoiceIDParams" scope="page"><bean:write name="paymentBean" property="amt"/></html:link></td>
                <td align="center"><html:link forward="affiliate-payment-delete" name="invoiceIDParams" scope="page" onclick="javascript:return confirm('Are you sure you want to delete this record?!?!')">Delete</html:link></td>
            </tr>
        </logic:iterate>

    </table>
    <br/>

    <div>
        <td align="center">
            <html:submit onclick="window.location.reload();" style="margin:auto; display:block">Approve</html:submit>
        </td>
    </div>
</html:form>

Aucun commentaire:

Enregistrer un commentaire