hoping someone can help……based on reading here and elsewhere, i thought this should work, but it doesn’t:
function threechecks()
{
test=0
for (var c=1;c<=3;c++)
{
var datecount=document.lunch[“choice”+c].length
for (var r=0;r<=datecount;r++)
{
if (document.lunch[“choice”+c][r].checked==true)
{
alert(“We found a check item for choice #”+c)
test=test+1
}
}
alert(test)
}
alert(“test value = “+test)
if (test<3) {return false}
}
and the function is called by onsubmit=”return threechecks()”
my form (named “lunch”) has a varying number of choices, from which the visitor must select one “choice1”, one “choice2” and one “choice3”. the above script loops just fine through the outer for loop, and will identify a checked item for “choice1”, but then it just skips the rest of the code, and submits the form. if there’s no selection for “choice1” it submits the form. in fact, it quits the function without showing the “alert(test)” that i put in after the inner for loop.
can anyone see where i’m going wrong?
tia,
janaki