Hello Everyone!
I know this is a php forum, but I have tried posting messages on javascript forums, and have not gotten responses. I know this is a good forum, so I thought someone here might be able to help me.
I have a form set up, and I had to use an array for some of the form values. Those form values in the array are required.
For example:
playerArray[0]=brown; // hair color
playerArray[1]=green; // eye color
playerArray[2]=18; // player age
playerArray[3]=5; // skill level
Each one of those spots in the array are required so I need to have a javascript to check to make sure all those spots are filled in before they submit the form.
I know how to use javascript to check for required fields using normal field names, however, when it goes into an array, I am not sure how exactly to run through the array and make sure each spot in the array has a value.
I was thinking something along these lines:
for (var i = 0; i < formName.myArray.length; i++) {
if (formName.myArray.value == ""){
return false;
}
}
Can someone give me some hits, or point me in the right direction?
Thanks for your time! Any response is greatly appreciated.
Leena