0

when i click on each button, i would like to do an action... and when in click on the image, i would like to call form action

but now it's seem like all button call form action

   <c:forEach var="userBeans" items="${userBeanList}" varStatus="statusReport">
        <form data-action="/secure/downloadcsvUser/${userBeans.key}">
            <tr>
                <td>${statusReport.count}</td>
                <td>${userBeans.value.title}</td>
                <td>
                    <c:if test="${userBeans.value.hasParams}">
                        <c:forEach var="paramName" items="${userBeans.value.listParamNames}" varStatus="statusParam">
                            ${paramName} <input type="text" id="${userBeans.key}${statusParam.count}" name="${paramName}" size="12" maxlength="10" />
                        </c:forEach>
                    </c:if>
                </td> 
                <td align="center">
                   <button id="editUserButton${statusReport.count}"></button>
                   <button id="deleteUserButton${statusReport.count}"></button>
                   <input type="image" height="25" width="25" src="/resources/img/report-run.png"/>
                </td>
            </tr>
        </form>
    </c:forEach>

maybe there is a more generic way to do it instead of using my form?

robert trudel
  • 5,283
  • 17
  • 72
  • 124
  • Why not use JS to override the onsubmit functions, take the id attribute and perform the function you want and override the submit function of the image to make an Ajax call to submit the form ? – Aditya Pawade Oct 25 '13 at 01:21

1 Answers1

1

The button element automatically submits forms, as their default 'type' attribute is 'submit' (see this question).

Community
  • 1
  • 1
Shawn Erquhart
  • 1,820
  • 2
  • 17
  • 30