0

I am using a display table in my jsp page.. It is like...

<display:table name="${MyList}" pagesize="10" requestURI=""  sort="page">
<display:setProperty name="paging.banner.placement" value="bottom" />
<display:column property="Language" sortable="true" title="Name" />
<display:column title="Read">
    <input type="checkbox" name="ReadOnly" id="1" onChange="toggle(this);">
</display:column>
<display:column title="Write">
    <input type="checkbox" name="Write" id="2" onChange="toggle(this);">
</display:column>
<display:column title="Speak">
    <input type="checkbox" name="Speak" id="3" onChange="toggle(this);">
</display:column>
</display:table>

It was working fine. And then i need to make only one combo box to be selected in each row. For that i used the javaScript function

<script type="text/javascript">
function toggle(chkBox) {
    alert("chk----"+chkBox);
    checkboxes = document.getElementsByTagName("input");
    alert("hai-----"+checkboxes);
    var isChecked = chkBox.checked;
    for (var i = 0; i < checkboxes.length; i++) {
        checkboxes[i].checked = false;
    }
    if (isChecked) {
        chkBox.checked = true;
    }
}
</script>

But now i can only select one of the whole checkboxes in myList. I want to select only one combobox from each row..

Firstlt i must say.. I dont need the radio button there.

Is it possible? and how can i make my code to achieve it???

Dil Se...
  • 877
  • 4
  • 16
  • 43
  • 1
    Why not use radio buttons instead of check-boxes? – Drona May 24 '12 at 10:03
  • @vikas i want to use the checkbox there. Thats y i asked for using combobox.. – Dil Se... May 24 '12 at 10:11
  • Check-boxes are inherently not mutually exclusive. For mutual exclusion you should be using radio buttons. However, you can use plain javascript or jquery to uncheck the others. Refer to this post for help http://stackoverflow.com/questions/4426482/how-to-disable-other-checkbox-on-click-of-one-check-box . It talks about similar requirement. – Drona May 24 '12 at 10:29

0 Answers0