I have js on a form page for users to be able to select all check boxes for classes to enter in a dogs show but I want to be able to offer the facility to select just classes on specific days as well and I don't know how to do it.
The form source code for each class to select looks like this:
<input type="hidden" name="day_id_normal[12]" value="5" />
<input type="hidden" name="day_id[12]" value="5" />
<input type="checkbox" name="class_number[]" id="gradeclass" value="12" />
The link to select all:
<a href="#" onclick="SetAllCheckBoxes('add-classes', 'gradeclass', true);return false;">Select All</a>
The JS Script:
function SetAllCheckBoxes(FormName, FieldName, CheckValue)
{
if(!document.forms[FormName])
return;
var objCheckBoxes = document.forms[FormName].elements[FieldName];
if(!objCheckBoxes)
return;
var countCheckBoxes = objCheckBoxes.length;
if(!countCheckBoxes)
objCheckBoxes.checked = CheckValue;
else
// set the check value for all check boxes
for(var i = 0; i < countCheckBoxes; i++)
objCheckBoxes[i].checked = CheckValue;
}
Not sure if I have included everything required to give information for anyone to help (please let me know if not) but the classes are split out by day so I am hoping I can use the reference to the day_id but not sure (am not sure if what I want to do is possible either).
Can anyone help please?