posted 19 years ago
Hi folks!
I'm developing a web application and there is an html form which contains a table with four columns. At the first column, I put checkboxes which allow the user remove the items specified on the second column. Moreover, each item may contain more than one subitem. So, at the third column I put checkboxes which allow the user remove the subitems specified on the forth column.
The first column checkboxes are named as "removeItem".
The third column checkboxes are names as "removeItem" + index of the item + "SubItem".
If the user check the checkbox of the first column, all subitems checkboxes related with the selected checkbox item must be checked.
The problem is that I don't know how to obtain the checkboxes of the third column when the first column checkbox is checked.
Someonde knows an solution for this problem?
Thanks!
Jo�o Cunha
PS:
I writed an javascript using the document.getElement() method, but it didn't wotk. It follows the code:
function selectItem(itemIndex) {
var items = document.teamForm.removeItem;
var subItems = document.getElementById("removeItem" + itemIndex + "SubItem");
if (items.length > 0) {
if (teamMember[teamMemberIndex].checked) {
checkAll(teamMemberRoles);
}
else {
clearAll(teamMemberRoles);
}
}
else {
if (teamMember.checked) {
checkAll(teamMemberRoles);
}
else {
clearAll(teamMemberRoles);
}
}
}
The methods checkAll and clearAll check and uncheck, respectively, all the checkboxes from a list