I have a huge form(7 pages worth) that I am trying to validate. I have three pages of nothing but radio button and checkboxes. Some pages are mixed between the above stated and text fields. I am trying to make a single .js file that validates the majority of it. I am new to javascript so the document object model is not very fresh in my head. Here is my code.
for (var i = 0; i < form.elements.length - 1; i++){
if( form.elements
.checked || form.elements
.value != "" ){
continue;
}
else{
err[ a ] = form.elements
.name;
a += 1;
}
}
The form.elements
.checked is giving me the problems. I am not getting an error but my script is not acting the way I want it to. If anyone has any suggestions or can direct me in a different, more efficient way, please let me know.
Thanks ahead of time.
for (var i = 0; i < form.elements.length - 1; i++){
if( form.elements
Code:
[i]
Code:
[i]
continue;
}
else{
err[ a ] = form.elements
Code:
[i]
a += 1;
}
}
The form.elements
Code:
[i]
Thanks ahead of time.