Hi there:
I have this function which validates chosend fields from the form and gives the alert poop up box on submission listing which all fields were not filled.
But for some reason...even after leaving al the fields blank..i am not getting any pop up box...here is my function:
function validateForm()
{
var count=0;
var msg="";
var ele = new Array();
ele[0]="firstname";
ele[1]="lastname";
ele[2]="address1";
ele[3]="city";
ele[4]="state";
ele[5]="zip";
ele[6]="email";
ele[7]="dayphone";
ele[8]="programofinterest";
ele[9]="campus";
ele[10]="todo";
ele[11]="hsdiploma";
ele[12]="yearofhs";
ele[13]="ged";
ele[14]="yearofgrad";
ele[15]="leadsource";
for(i=0;i<ele.length;i++)
{
if(document.contact.ele.value=="")
{
count=1;
msg=msg+"\n"+document.contact.ele.name;
}
else if((i>ele.length) && (count==0))
{
return(true);
}
}
for(i=0;i<ele.length;i++)
{
if(document.contact.ele.value=="")
{
alert("PLEASE FILL IN THE FOLLOWING FIELD(S)\n "+msg);
document.contact.ele.focus();
return(false);
}
}
}
I have this function which validates chosend fields from the form and gives the alert poop up box on submission listing which all fields were not filled.
But for some reason...even after leaving al the fields blank..i am not getting any pop up box...here is my function:
function validateForm()
{
var count=0;
var msg="";
var ele = new Array();
ele[0]="firstname";
ele[1]="lastname";
ele[2]="address1";
ele[3]="city";
ele[4]="state";
ele[5]="zip";
ele[6]="email";
ele[7]="dayphone";
ele[8]="programofinterest";
ele[9]="campus";
ele[10]="todo";
ele[11]="hsdiploma";
ele[12]="yearofhs";
ele[13]="ged";
ele[14]="yearofgrad";
ele[15]="leadsource";
for(i=0;i<ele.length;i++)
{
if(document.contact.ele.value=="")
{
count=1;
msg=msg+"\n"+document.contact.ele.name;
}
else if((i>ele.length) && (count==0))
{
return(true);
}
}
for(i=0;i<ele.length;i++)
{
if(document.contact.ele.value=="")
{
alert("PLEASE FILL IN THE FOLLOWING FIELD(S)\n "+msg);
document.contact.ele.focus();
return(false);
}
}
}