Reputation: 125
` User ID Leave Type Start Date End Date Status Approve/Reject
</tr>
<c:forEach var="roww" items="${resultt.rows}">
<tr>
<td><c:out value="${roww.uid}"/></td>
<td><c:out value="${roww.type}"/></td>
<td><c:out value="${roww.stdt}"/></td>
<td><c:out value="${roww.enddt}"/></td>
<td><input type="button" value="Approve" name="app" onclick="approval();" />
<input type="button" value="Reject" name="rej" onclick="rejection();" />
`
I want to call a function approval()
when the Approve button is clicked.
The Function needs to access data values from the row in which it is clicked.
I also need to change the value of Status column in the database for that particular row.
I'm using JSP and MySQL database
Upvotes: 0
Views: 116
Reputation: 117
adding this as a parameter in approval should give you the dom element clicked you can then navigate from there i.e approval(this);
what's "this" in javascript onclick?
i would recommend using something like jQuery to attach the event listener thou.
Upvotes: 1