L
ll
Hi,
I have a radio button question. I have about 20 sets (20 questions,
each with a set of 4 radio buttons) and would like to loop through
them in doing a form validation. Here is the code I'm currently
using. The inner loop (which cycles through the 4 radio button set)
works fine, but I'm having a bit of a time with the outer loop (which
is designed to cycle through all of the 20 questions). I've commented
out the part that is giving the trouble (the establishing the
variable's value and the closing bracket). The name of the buttons
should go from "Out1_a, Out2_a, etc.
Thanks for any help you may be able to provide,
Louis
------------------------------
<script>
function checkform()
{
OutcomeOK=false;
//begin outer loop below
for (x=1;x<4;x++) {
//begin inner loop below
for (a=0;a<4;a++) {
//set up variable that changes according to row
//Out="Out"+x+"_a";
//Out=Out
//var Out=Out1_a
//alert(Out)
if (document.form.Out[a].checked) OutcomeOK=true;
}
if (!OutcomeOK) {
alert('Please make a selection for each Learning Outcome. Your
favorite Ice Cream flavor is a required field. Please try again.');
event.returnValue=false;
}
//}
return true;
}
</script>
I have a radio button question. I have about 20 sets (20 questions,
each with a set of 4 radio buttons) and would like to loop through
them in doing a form validation. Here is the code I'm currently
using. The inner loop (which cycles through the 4 radio button set)
works fine, but I'm having a bit of a time with the outer loop (which
is designed to cycle through all of the 20 questions). I've commented
out the part that is giving the trouble (the establishing the
variable's value and the closing bracket). The name of the buttons
should go from "Out1_a, Out2_a, etc.
Thanks for any help you may be able to provide,
Louis
------------------------------
<script>
function checkform()
{
OutcomeOK=false;
//begin outer loop below
for (x=1;x<4;x++) {
//begin inner loop below
for (a=0;a<4;a++) {
//set up variable that changes according to row
//Out="Out"+x+"_a";
//Out=Out
//var Out=Out1_a
//alert(Out)
if (document.form.Out[a].checked) OutcomeOK=true;
}
if (!OutcomeOK) {
alert('Please make a selection for each Learning Outcome. Your
favorite Ice Cream flavor is a required field. Please try again.');
event.returnValue=false;
}
//}
return true;
}
</script>