I am attempting to validate radio buttons in Netscape with JavaScript.
Everything works excellent in Explorer, but refuses to work in Netscape
(all versions).
=========== JAVASCRIPT CODE ========================
function ValidateTest()
{
var q1 = false;
var q2 = false;
for (counter = 0; counter < TEST.Q1.length; counter++)
{
if (TEST.Q1[counter].checked)
q1 = true;
}
for (counter = 0; counter < TEST.Q2.length; counter++)
{
if (TEST.Q2[counter].checked)
q2 = true;
}
if (!q1)
{
alert("Please select an answer for Question #1.");
return false;
}
else if (!q2)
{
alert("Please select an answer for Question #2.");
return false;
}
document.TEST.submit();
}
=========== HTML FORM CODE =========================
<form name="TEST" method="post" action="evaluation-e.cfm">
<ol>
<li>Question 1?<br>
<input type="radio" name="Q1" value="1">1<br>
<input type="radio" name="Q1" value="2">2<br>
<input type="radio" name="Q1" value="3">3<br>
<input type="radio" name="Q1" value="4">4<br>
<input type="radio" name="Q1" value="5">5<br><br>
</li>
<li>Question 2?
<br><input type="radio" name="Q2" value="1">1<br>
<input type="radio" name="Q2" value="2">2<br>
<input type="radio" name="Q2" value="3">3<br>
<input type="radio" name="Q2" value="4">4<br>
<input type="radio" name="Q2" value="5">5<br><br>
</li>
</ol>
<input type="button" value="Continue" onClick="ValidateTest()">
</form>
================================================== ==
The JavaScript error that I receive is the following:
"TEST is not defined."
================================================== ==
TEST is the name of my form. Is there any quick fix that I can do to
the code above to make it work in Netscape?
Sincerely,
Marc