the names of variables in html are array ... like question[1], question[2] ... etc.
and every question has multiple value, depending of the answer.
[HTML]<form action="thx.php" method=POST name=form onSubmit="return check(this)">[/HTML]
In javascript i have to determinate if the question is answered, if it is not then return false ...
Expand|Select|Wrap|Line Numbers
- 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;
- }
- }
What is wrong now?
How javascript handle two dimensional array?
pls help :)