meriwether
Programmer
is is possible to nest if statments? it seems somewhat logical, but i cannot get this to work properly.
here's a snippit of the code:
// Phone Number Validation
if(phone != "Phone Number"
{ // phone # is optional
if(!validatePhone(phone)) {
window.document.formname.phone.focus();
alert('Please enter a valid Phone Number');
return false;
}
} // phone # is optional
else {
// Email Address Validation
if(emailaddress != "Email Address"
{ // email address is optional
if(!validateEmail(emailaddress)) {
window.document.formname.emailaddress.focus();
alert('Please enter a valid Email Address');
return false;
}
} // email address is optional
else {
// Passed Validation
return true; // form validation passed
}
}
any pointers on nesting if statements would be greatly appreciated. need more info, i'll post all the code i suppose. thx.
here's a snippit of the code:
// Phone Number Validation
if(phone != "Phone Number"
if(!validatePhone(phone)) {
window.document.formname.phone.focus();
alert('Please enter a valid Phone Number');
return false;
}
} // phone # is optional
else {
// Email Address Validation
if(emailaddress != "Email Address"
if(!validateEmail(emailaddress)) {
window.document.formname.emailaddress.focus();
alert('Please enter a valid Email Address');
return false;
}
} // email address is optional
else {
// Passed Validation
return true; // form validation passed
}
}
any pointers on nesting if statements would be greatly appreciated. need more info, i'll post all the code i suppose. thx.