In html i have some question, and the answers are radio buttons ...
the names of variables in html are array ... like question[1], question[2] ... etc.
and every question has multiple value, depending of the answer.

<form action="thx.php" method=POST name=form onSubmit="return check(this)">

In javascript i have to determinate if the question is answered, if it is not then return false ...

function check(form) {


    a=0;
    for (i=0;i<form.question[1].length;i++){
    if (form.question[1][i].checked===true)  {a=1;}
    }
    if (a==0) {
    alert("question[1] no.1: You didn't answer the question");
    return false;
    }
}

Everything work fine until i changed my variables into arrays.
What is wrong now?
How javascript handle two dimensional array?

pls help :)

O_o maybe javascript doesn't do what you think it does... or maybe that's too incomplete a code snippet to see what your trying to do. forms.question[1] doesn't look like a DOM object reference.. and it wont neccessarily relate to any input element(s) on your HTML page...

what is the HTML code you are using?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.