user3270763
user3270763

Reputation: 125

Values access in function from HTML table which shows entries from database

` 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

Answers (1)

PB1
PB1

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.

jQuery API click

Upvotes: 1

Related Questions