This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes How to get a checkbox list using javascript? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "How to get a checkbox list using javascript?" Watch "How to get a checkbox list using javascript?" New topic
Author

How to get a checkbox list using javascript?

Joao Cunha
Greenhorn

Joined: Jul 12, 2004
Posts: 24
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to get a checkbox list using javascript?
 
Similar Threads
How can we render a jsf element with a # inside #
Iterating tags in Seam (ui:repeat and c:forEach)
passing values from checkbox to javascript
Iterating tags in Seam (ui:repeat and c:forEach)
How to get a scriptlet value for javascript validation