I have a group of 29 checkboxes that I need to require at least one be checked prior to someone saving the form. (The validation taking place prior to Saving is critical.) Since there are 29 checkboxes in the group, I’d like to use an array rather than individually addressing each box. Unfortunately this has proved to be beyond my scripting abilities.
Below is the script that I’ve been trying to use/adapt. It doesn’t seem to do anything, and I’m not even sure on which event I should be placing it.
var checkboxVal =false;
for (var i=0; i<WCForm.InjuredBodyPart.length; i++)
{
if (WCForm.InjuredBodyPart[i].checked) checkboxVal =true;
}
if (!checkboxVal)
{
alert("Please select at least one Injured Body Part.");
returnfalse;
}