I do not understand what you are trying to check....
That the fields have been filled out and not empty??
Plus, the weekNumber[n] fields have nothing to do with the dynamically created inputs (
name, age, sex) and without knowing how the two correlate to each other there is no way to know what is going on....
But the short answer to checking that all fields are filled out is to loop thru the form elements and checking the value.length...
Code:
function validate(form){
for(var i=0; i<form.elements.length; i++){
if(form.elements[i].value.length == 0){
alert('All fields must be filled out');
form.elements[i].focus();
return false;
}
}
}
And:
<form onsubmit="validate(this)".....
.....Willy