ojoonline
12-24-2005, 10:07 AM
hi,
This is the code I have so far. I would like to make the 'Select all' checkboxes only select all of the checkboxes in its group. And then deselect when it's unchecked.
I've had a good look around and couldn't find how to make this work with groups on the page.
Would be great if anyone knows of any script here that might be able to help.
thanks,
jo
This is an example of how I need it to work:
http://www.textit.com.au/checkboxform.cfm
and this is the code:
<script>
function toggle(theDiv) {
var elem = document.getElementById(theDiv);
elem.style.display = (elem.style.display == "none")?"":"none";
}
//-->
</script>
<form action="checkboxForm.cfm" method="post">
<!---display group name--->
<a href="#" class="bodyItemSmall" onclick="toggle('group1');return false;">Group 1</a><br>
<div id="group1" style="display: none;">
<!---get the group here--->
<table width="100%" border="0" cellspacing="0" cellpadding="2" bgcolor="#CCCCCC">
<tr>
<td><input type="checkbox" name="selectAll" value="checkbox"> Select all
</td>
</tr>
</table>
<!---display the group here--->
<input type="checkbox" name="contactID" value="1">firstName lastName<br>
<input type="checkbox" name="contactID" value="2">firstName lastName<br>
<input type="checkbox" name="contactID" value="3">firstName lastName<br>
</div>
<!---display group name--->
<a href="#" class="bodyItemSmall" onclick="toggle('group2');return false;">Group 2</a>
<div id="group2" style="display: none;">
<!---get the group here--->
<table width="100%" border="0" cellspacing="0" cellpadding="2" bgcolor="#CCCCCC">
<tr>
<td><input type="checkbox" name="selectAll" value="checkbox"> Select all
</td>
</tr>
</table>
<!---display the group here--->
<input type="checkbox" name="contactID" value="1">firstName lastName<br>
<input type="checkbox" name="contactID" value="6">firstName lastName<br>
<input type="checkbox" name="contactID" value="8">firstName lastName<br>
</div>
</form>
This is the code I have so far. I would like to make the 'Select all' checkboxes only select all of the checkboxes in its group. And then deselect when it's unchecked.
I've had a good look around and couldn't find how to make this work with groups on the page.
Would be great if anyone knows of any script here that might be able to help.
thanks,
jo
This is an example of how I need it to work:
http://www.textit.com.au/checkboxform.cfm
and this is the code:
<script>
function toggle(theDiv) {
var elem = document.getElementById(theDiv);
elem.style.display = (elem.style.display == "none")?"":"none";
}
//-->
</script>
<form action="checkboxForm.cfm" method="post">
<!---display group name--->
<a href="#" class="bodyItemSmall" onclick="toggle('group1');return false;">Group 1</a><br>
<div id="group1" style="display: none;">
<!---get the group here--->
<table width="100%" border="0" cellspacing="0" cellpadding="2" bgcolor="#CCCCCC">
<tr>
<td><input type="checkbox" name="selectAll" value="checkbox"> Select all
</td>
</tr>
</table>
<!---display the group here--->
<input type="checkbox" name="contactID" value="1">firstName lastName<br>
<input type="checkbox" name="contactID" value="2">firstName lastName<br>
<input type="checkbox" name="contactID" value="3">firstName lastName<br>
</div>
<!---display group name--->
<a href="#" class="bodyItemSmall" onclick="toggle('group2');return false;">Group 2</a>
<div id="group2" style="display: none;">
<!---get the group here--->
<table width="100%" border="0" cellspacing="0" cellpadding="2" bgcolor="#CCCCCC">
<tr>
<td><input type="checkbox" name="selectAll" value="checkbox"> Select all
</td>
</tr>
</table>
<!---display the group here--->
<input type="checkbox" name="contactID" value="1">firstName lastName<br>
<input type="checkbox" name="contactID" value="6">firstName lastName<br>
<input type="checkbox" name="contactID" value="8">firstName lastName<br>
</div>
</form>