0

A list is passed to the display:table. In the table i need to have a checkbox column to select/deselect any transactions that are selected. How do i associate the checked item with the transaction. Also i need to pass this checked transaction to a java script. Thanks

Jsp code:

<display:column title="<input type='checkbox' name='selectall' onClick='selectAll()' />" media="html">
    <input type="checkbox" name="selectBox" class="selectableCheckbox" id="selectBox" value="${sample.txniD}"></>
</display:column>
<display:column property="txniD" sortable="true" scope="all" title="Transaction ID %>" />
JB Nizet
  • 678,734
  • 91
  • 1,224
  • 1,255
vicky
  • 31
  • 2
  • 4
  • You already associated it, since the value of the checkbox is the corresponding transaction ID. WHat's the problem exactly? – JB Nizet Apr 21 '12 at 11:00
  • Thanks JB.to verify in the onClick='selectAll' js i added an alert to print the value selected. selectAll() { var selectall = document.getElementsByName("selectall"); var checkboxArray = document.getElementsByName('selectBox'); if(selectall[0].checked == true){ for(var i = 0 ; i – vicky Apr 21 '12 at 11:45
  • selectAll() { var selectall = document.getElementsByName("selectall"); var checkboxArray = document.getElementsByName('selectBox'); if(selectall[0].checked == true){ for(var i = 0 ; i – vicky Apr 21 '12 at 11:49

1 Answers1

0

Try alerting the value of the checkbox, alert(checkboxArray[i].value);, not toString.

Bhesh Gurung
  • 50,430
  • 22
  • 93
  • 142
  • Hello, Thank you for answering. But "${sample.txniD}", does not work. Instead of printing the Txn id. It prints "${sample.txniD}". Any suggestions as to how i can fetch the txn id? – vicky Apr 22 '12 at 04:51
  • Looks like that EL expression is not evaluated. Are you using EL in other places on the same page and are they working? – Bhesh Gurung Apr 22 '12 at 17:27
  • No i am not using EL expressions anywhere else. – vicky Apr 23 '12 at 17:40
  • IMO, I think first, you have to make sure that EL is not ignored in your jsp. You might want to refer to this question: http://stackoverflow.com/q/793983/738746 – Bhesh Gurung Apr 23 '12 at 19:30