Jump to content

Welcome to Geeks to Go - Register now for FREE

Geeks To Go is a helpful hub, where thousands of volunteer geeks quickly serve friendly answers and support. Check out the forums and get free advice from the experts. Register now to gain access to all of our features, it's FREE and only takes one minute. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more.

Create Account How it Works


  • Please log in to reply




  • Member
  • PipPip
  • 13 posts
I have an error (in syntax, I think) somewhere in the following code. I cannot find what is wrong.

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() )
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;
alert("\n You have chosen to abort the submission.");
return false;

return false;

Can someone point me to the problem?

Thanks very much for taking time to look into this for me.
  • 0


Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP