I'm trying to get a set of checkboxes to check other boxes, however I'm having big trouble in that I can't get the Javascript function to check a box that is named as an array...
<INPUT TYPE='checkbox' name=\"".$row[TestType]."[$i]\">
This generates source code like:
Regression[0]
Regression[1]
etc
When I select one of the controller checkboxes, this function is called:
function checkBoxValidate(cb, count) {
if (eval("document.myform." + cb + ".checked") == true)
{
//alert("checked");
for (j = 0; j < count; j++)
{
alert("document.myform3.elements[" + cb + '[' + j + ']' + "].checked = true");
eval("document.myform3.elements[" + cb + '[' + j + ']' + "].checked = true");
}
}
else
{
...
The code that calls the function is:
print"<TD>Check All $row_1[TestType]<input type=checkbox name=\"".$row_1[TestType]."\" onClick=javascript:checkBoxValidate(name,loopCount[$x])></TD>";
I've had it working when the checkbox were all named the same, however PHP didn't seem to pick up the values on the next page.
Any ideas?