Here's what the code SHOULD do:
1. a web page user wants to join an association via an online membership form.
2. certain fields in the form are "required" fields.
3. on Submit, the function submit forms() is invoked to check various required fields for non-blanks.
4. the function checks the first group of fields for non-blanks and, if these fields are non-blank, checks to see if field, 'membershiptype' is not equal to "Retired ($25)." If true, the function continues with the checking for non-blanks for the rest of the fields on the form and then alerts a msg indicating the form is about to be submitted.
5. If any one field is blank, an alert is issued indicating so and focus is set back to the field with the blank entry.
I havethis whole validity-checkig process working until I added the check a 'membershiptype.' With that code added the function ALWAYS return true, even when I leave the first requires field blank.
So, it looks like something is wrong in my syntax or my if ...else clauses. Here's the code:
++++++++++++++++++++++++++++++
function submitForms() {
if ( iscardholderfirstname() && iscardholderlastname() && isEmail() && isPhone1() && isPhone2() && isPhone3() && isAddress1() && isCity() && isUsstate() && isZip() && isBMonth() && isBDay() && isBYear() && isMembershipType() && isNewOrRenewal() )
if ( document.addform.MembershipType.value != "Retired ($25)")
if ( isSchool() && isCounty() && isPosition() && isCardType() && isCardNumber1() && isCardNumber2() && isCardNumber3() && isCardNumber4() && isExpireMonth() && isExpireYear() )
else
if ( isNewOrRenewal() && isCardType() && isCardNumber1() && isCardNumber2() && isCardNumber3() && isCardNumber4() && isExpireMonth() && isExpireYear() )
}
if (confirm("\n Your application is now ready to be submitted for processing. \n\nClick OK to submit; Cancel to abort."))
{
alert("\nYour submission will now be sent.\n\n\n Thank you for supporting PSTA.");
return true;
}
else
{
alert("\n You have chosen to abort the submission.");
return false;
}
else
return false;
}
++++++++++++++++++++++++++++++++++++
Can someone point me to the problem?
Thanks very much for taking time to look into this for me.