Select all checkbox on multiple update
I have a page with a repeat region and multiple update. It is updating the value of a checkbox. This all works however there are 200 records on each page and if the user is wanting to select all of them they must tick every box individually. Is there a way of adding a checkbox at the top to select all. I have found a code that will do this on a normal set of checkboxes however because of the multiple update the checkboxes are named:"SendText_<?php echo $RepeatSelectionCounter_1; ?>" - not simply 'SendText'
With the code I have the inputs would need to have the same name. This is the javascript code:
<script language="JavaScript">
function toggle(source) {
checkboxes = document.getElementsByName('SendText');
for each(var checkbox in checkboxes)
checkbox.checked = source.checked;
}
</script>
<input type="checkbox" name="master" id="master" value="Y" onClick="toggle(this)" />
<input <?php if (!(strcmp($row_WADALeads['SendText'],"Y"))) {echo "checked=\"checked\"";} ?> name="SendText_<?php echo $RepeatSelectionCounter_1; ?>" type="checkbox" id="SendText_<?php echo $RepeatSelectionCounter_1; ?>" value="Y" />
<input <?php if (!(strcmp($row_WADALeads['SendText'],"Y"))) {echo "checked=\"checked\"";} ?> name="SendText_<?php echo $RepeatSelectionCounter_1; ?>" type="checkbox" id="SendText_<?php echo $RepeatSelectionCounter_1; ?>" value="Y" />