Greetings,
I have an ASP page containing a Record Insertion Form with a number of fields linked to an Access database. Within this form, I have a fieldset with six checkboxes, one of which is a "Select ALL" checkbox that selects or unselects all checkboxes in the fieldset.
My problem is that when I select the "Select ALL" checkbox, it selects every checkbox in the form, not just those in the fieldset.
Here is the code for the "Select ALL" checkbox:
<td><input type="checkbox" name="PIC_RgnIm pact_SelectALL" "value="1" onclick='RgnChe ckedAll(form1); '/></td>
Here is the Javascript for the function:
<script language=javasc ript>
checked=false;
function RgnCheckedAll (form1) {
var aa= document.getEle mentById('form1 ');
if (checked == false)
{
checked = true
}
else
{
checked = false
}
for (var i =0; i < aa.elements.len gth; i++)
{
aa.elements[i].checked = checked;
}
}
</script>
I'm relatively new to Javascript and am unsure how to code the form to capture only the checkboxes in my fieldset.
Whatever advice anyone has would be much appreciated.
- JM
I have an ASP page containing a Record Insertion Form with a number of fields linked to an Access database. Within this form, I have a fieldset with six checkboxes, one of which is a "Select ALL" checkbox that selects or unselects all checkboxes in the fieldset.
My problem is that when I select the "Select ALL" checkbox, it selects every checkbox in the form, not just those in the fieldset.
Here is the code for the "Select ALL" checkbox:
<td><input type="checkbox" name="PIC_RgnIm pact_SelectALL" "value="1" onclick='RgnChe ckedAll(form1); '/></td>
Here is the Javascript for the function:
<script language=javasc ript>
checked=false;
function RgnCheckedAll (form1) {
var aa= document.getEle mentById('form1 ');
if (checked == false)
{
checked = true
}
else
{
checked = false
}
for (var i =0; i < aa.elements.len gth; i++)
{
aa.elements[i].checked = checked;
}
}
</script>
I'm relatively new to Javascript and am unsure how to code the form to capture only the checkboxes in my fieldset.
Whatever advice anyone has would be much appreciated.
- JM
Comment