hi
i want to do validation on two textboxes on my website i am creating. i want to make sure something is entered in each box before the user can proceed. the two textboxes are called teammanager and teamname and are in the form called addteam.
the code i have done only seem to check the first text box and i am new to javascript and cannot workout whats wrong with my code. below is my code help would be much appreciated
function Length_TextField_Validator()
{
// Check the length of the value of the teamname and teammanager
if ((addteam.teamname.value.length < 3) || (addteam.teamname.value.length > 20))
{
// alert box message
mesg = "You have entered " + addteam.teamname.value.length + " character(s)\n"
mesg = mesg + "Valid entries are between 3 and 20 characters for team name.\n"
alert(mesg);
// Place the cursor on the field
addteam.teamname.focus();
// return false to stop user going any further
return (false);
}
else if ((addteam.teamamanger.value.length < 3) || (addteam.teammanager.value.length > 20))
{
mesg = "You have entered " + addteam.teammanager.value.length + " character(s)\n"
mesg = mesg + "Valid entries are between 3 and 20 characters for team manager\n"
alert(mesg);
// Place the cursor on the field
addteam.teammanager.focus();
// return false to stop user going any further
return (false);
}
else {
// If teamname and teammanager is not null continue processing
return (true);
}
}