I'm working on a online questionare. The site reads in the questions from a text file so the number of questions and radio button groups is unknown until the asp page runs. I need to validate that the user answered all the questions before the onclick event of the submit button. I am trying to use a javascript function to do this.
The problem I'm running into is how to append the for loop counter variable to the end of a control name.
ie. question1, question2, question3 ...
Here's my code (I know the array style syntax is incorrect, I just put it there to try to show what I was doing.)
function CheckAnswers(iCount)
{
for(int i=1, i<iCount, i++)
{
if (survey.question(i).value != 1)
{
//do something
}
}
}
Any help is greatly appreciated!!!
Thanks in advance,
Scott
The problem I'm running into is how to append the for loop counter variable to the end of a control name.
ie. question1, question2, question3 ...
Here's my code (I know the array style syntax is incorrect, I just put it there to try to show what I was doing.)
function CheckAnswers(iCount)
{
for(int i=1, i<iCount, i++)
{
if (survey.question(i).value != 1)
{
//do something
}
}
}
Any help is greatly appreciated!!!
Thanks in advance,
Scott