Link to home
Start Free TrialLog in
Avatar of Andrew Angell
Andrew AngellFlag for United States of America

asked on

Trouble with IE and disabling form buttons onclick...???

I'm simply trying to disable the submit button on this form upon clicking it so that users won't click it again thinking it didn't work.  I added the following to my submit button...

onclick="this.disabled=true;"

Which works beautifully in FireFox, however, in IE when I click the button it disables just fine but the form doesn't actually submit.  The status bar does nothing.  then you're just sitting on the checkout page at a grayed out submit button and nothing is happening.  

All of the Googling I've done doesn't mention anything about this problem in IE.  Any ideas???
Avatar of Lolly-Ink
Lolly-Ink
Flag of Australia image

Try this:
onclick="window.setTimeout('document.getElementById(this.id).disabled=true', 250)"

Open in new window

Syntax fix:
onclick="window.setTimeout('document.getElementById(\"' + this.id + '\").disabled=true', 250)"

Open in new window

Avatar of Andrew Angell

ASKER

That one's giving me syntax errors in Dreamweaver too..??
ASKER CERTIFIED SOLUTION
Avatar of black0ps
black0ps
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Sorry, I'm not very good with JavaScript obviously.

My form already has an onsubmit property that runs a function to validate the form data.  Can I add 2 functions to an onsubmit property?  I tried doing so and separating with a comma but I got a syntax error.
Hmmm, well, I think I figured out the syntax problem but now it seems to simply not be working.  The form has validation functions getting run ( I removed most of them here ) and then I just added the line you gave me on the end...

<form action="" method="post" name="CheckoutInfo" id="CheckoutInfo" onsubmit="WAValidateRQ(document.CheckoutInfo.PayerFirstName,'- First Name is required',document.CheckoutInfo.PayerFirstName,0,false,'text'); document.getElementById('Submit').disabled=true;">

The submit button on this form has an ID of Submit.  In both FF and IE now, though, I don't ever see the button get grayed out.
You don't want to add a second function to the onSubmit function because if your data returns invalid, the submit button will be disabled.

You want to add it to one of the last items in the onSubmit function. Post the WAVadlidateRQ() function.
I've attached the full page.  No matter what I try I can't seem to get the thing to disable at all unless I go with my first attempt using onclick.  
Well, crap.  I'm selecting a zip file (which is in the list of accepted extensions) but it's not accepting it.  

<?php
//WA eCart Include
require_once("WA_eCart/eCart_PHP.php");
?>
<?php
$eCart->GetContent();
?>
<?php
// WA eCart Redirect
if ($eCart->redirStr != "")     {
  header("Location: ".$eCart->redirStr);
}
?>
<?php
if(!session_id()) session_start();
 
if(isset($_POST['CreditCardType']))
{	
	require_once('includes/sandbox.php');
	require_once('includes/paypal-nvp-session.php');
	require_once('includes/fedex-session.php');
	
	$ppConfig = array('Sandbox' => $sandbox);
	$ppPro = new PayPalPro($ppConfig);
	
	$CustomerData = array();
	$CustomerData['first_name'] = $_POST['PayerFirstName'];
	$CustomerData['last_name'] = $_POST['PayerLastName'];
	$CustomerData['billing_address1'] = $_POST['PayerStreetAddress1'];
	$CustomerData['billing_address2'] = $_POST['PayerStreetAddress2'];
	$CustomerData['billing_city'] = $_POST['PayerCity'];
	$CustomerData['billing_country_code'] = $_POST['PayerCountry'];
	$CustomerData['billing_country_name'] = $ppPro -> GetCountryName($CustomerData['billing_country_code']);
	$CustomerData['billing_postal_code'] = $_POST['PayerPostalCode'];
	$CustomerData['billing_state'] = strtoupper($_POST['PayerState']);
	$CustomerData['company_name'] = $_POST['PayerCompany'];
	$CustomerData['email_address'] = $_POST['PayerEmailAddress'];
	$CustomerData['phone_number'] = $_POST['PayerPhoneNumber'];
	$_SESSION['CustomerData'] = $CustomerData;
	
	$InvoiceData = array();
	$InvoiceData['shipping_phone'] = $_POST['ShipPhoneNumber'];
	$InvoiceData['address_city'] = $_POST['ShipCity'];
	$InvoiceData['address_country'] = $ppPro -> GetCountryName($_POST['ShipCountry']);
	$InvoiceData['address_name'] = $_POST['ShipToFirstName'] . ' ' . $_POST['ShipToLastName'];
	$InvoiceData['address_state'] = strtoupper($_POST['ShipState']);
	$InvoiceData['address_street1'] = $_POST['ShipStreet1'];
	$InvoiceData['address_street2'] = $_POST['ShipStreet2'];
	$InvoiceData['address_zip'] = $_POST['ShipPostalCode'];
	$InvoiceData['memo'] = $_POST['CustomerNotes'];
	$_SESSION['InvoiceData'] = $InvoiceData;
	
	$_SESSION['CreditCardType'] = $_POST['CreditCardType'];
	$_SESSION['CreditCardNumber'] = $_POST['CreditCardNumber'];
	$_SESSION['CreditCardExpMonth'] = $_POST['CreditCardExpMonth'];
	$_SESSION['CreditCardExpYear'] = $_POST['CreditCardExpYear'];
	$_SESSION['CreditCardCVV2'] = $_POST['CreditCardCVV2'];
	
	$_SESSION['PreferredDeliveryDate'] = $_POST['PreferredDeliveryDate'];
	
	// Calculate sales tax
	if(strtoupper($_SESSION['CustomerData']['billing_state']) == 'NY')
	{
		$_SESSION['SalesTaxTotal'] = round($eCart->TotalColumn("TotalPrice") * .08625,2);
		if(strtoupper($_SESSION['CustomerData']['billing_city']) == 'NY' || strtoupper($_SESSION['CustomerData']['billing_city']) == 'NEW YORK' || strtoupper($_SESSION['CustomerData']['billing_city']) == 'NEW YORK CITY' || strtoupper($_SESSION['CustomerData']['billing_city']) == 'NYC')
		{
			$NewYorkCityTax = round($eCart->TotalColumn("TotalPrice") * .04,2);
			$_SESSION['SalesTaxTotal'] = $_SESSION['SalesTaxTotal'] + $NewYorkCityTax;
		}
	}
	else
		$_SESSION['SalesTaxTotal'] = 0;
		
	header('Location: paypal-direct-payment-review.php');
	exit();
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
 
<title>Payment Information - The Green Apple Bag - Reusable Grocery bag, New York City</title>
 
<link href="green_apple_styles.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.style2 {font-size: x-small}
-->
</style>
 
<link href="WA_eCart/CSS/eC_Clean_Pacifica_Arial.css" rel="stylesheet" type="text/css" />
<script type="text/JavaScript">
<!--
<!-- Begin
var ShipToFirstName = "";
var ShipToLastName = "";
var ShipCompany = "";
var ShipStreet1 = "";
var ShipStreet2 = "";
var ShipCity = "";
var ShipState = "";
var ShipPostalCode = "";
var ShipCountry = "";
var ShipPhoneNumber = "";
 
function InitSaveVariables(form) {
ShipToFirstName = form.ShipToFirstName.value;
ShipToLastName = form.ShipToLastName.value;
ShipCompany = form.ShipCompany.value;
ShipStreet1 = form.ShipStreet1.value;
ShipStreet2 = form.ShipStreet2.value;
ShipCity = form.ShipCity.value;
ShipPostalCode = form.ShipPostalCode.value;
ShipState = form.ShipState.value;
ShipCountry = form.ShipCountry.value;
ShipPhoneNumber = form.ShipPhoneNumber.value;
}
 
function ShipToBillPerson(form) {
if (form.sameAsBilling.checked) {
InitSaveVariables(form);
form.ShipPhoneNumber.value = form.PayerPhoneNumber.value;
form.ShipToFirstName.value = form.PayerFirstName.value;
form.ShipToLastName.value = form.PayerLastName.value;
form.ShipCompany.value = form.PayerCompany.value;
form.ShipStreet1.value = form.PayerStreetAddress1.value;
form.ShipStreet2.value = form.PayerStreetAddress2.value;
form.ShipCity.value = form.PayerCity.value;
form.ShipPostalCode.value = form.PayerPostalCode.value;
form.ShipState.value = form.PayerState.value;
form.ShipCountry.value = form.PayerCountry.value
}
else {
form.ShipToFirstName.value = ShipToFirstName;
form.ShipToLastName.value = ShipToLastName;
form.ShipCompany.value = ShipCompany;
form.ShipStreet1.value = ShipStreet1;
form.ShipStreet2.value = ShipStreet2;
form.ShipCity.value = ShipCity;
form.ShipPostalCode.value = ShipPostalCode;       
form.ShipState.value = ShipState;
form.ShipCountry.value = ShipCountry;
form.ShipPhoneNumber.value = ShipPhoneNumber;
   }
}
//  End
 
function DisableSubmitButton(ButtonName) {
	document.getElementById(ButtonName).disabled=true;
}
 
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function WAtrimIt(theString,leaveLeft,leaveRight)  {
  if (!leaveLeft)  {
    while (theString.charAt(0) == " ")
      theString = theString.substring(1);
  }
  if (!leaveRight)  {
    while (theString.charAt(theString.length-1) == " ")
      theString = theString.substring(0,theString.length-1);
  }
  return theString;
}
 
function WAFV_GetValueFromInputType(formElement,inputType,trimWhite) {
  var value="";
  if (inputType == "select")  {
    if (formElement.selectedIndex != -1 && formElement.options[formElement.selectedIndex].value && formElement.options[formElement.selectedIndex].value != "") {
      value = formElement.options[formElement.selectedIndex].value;
    }
  }
  else if (inputType == "checkbox")  {
    if (formElement.length)  {
      for (var x=0; x<formElement.length ; x++)  {
        if (formElement[x].checked && formElement[x].value!="")  {
          value = formElement[x].value;
          break;
        }
      }
    }
    else if (formElement.checked)
      value = formElement.value;
  }
  else if (inputType == "radio")  {
    if (formElement.length)  {
      for (var x=0; x<formElement.length; x++)  {
        if (formElement[x].checked && formElement[x].value!="")  {
          value = formElement[x].value;
          break;
        }
      }
    }
    else if (formElement.checked)
      value = formElement.value;
  }
  else if (inputType == "radiogroup")  {
    for (var x=0; x<formElement.length; x++)  {
      if (formElement[x].checked && formElement[x].value!="")  {
        value = formElement[x].value;
        break;
      }
    }
  }
  else if (inputType == "iRite")  {
     var theEditor = FCKeditorAPI.GetInstance(formElement.name) ;
     value = theEditor.GetXHTML(true);
  }
  else  {
    var value = formElement.value;
  }
  if (trimWhite)  {
    value = WAtrimIt(value);
  }
  return value;
}
 
function WAAddError(formElement,errorMsg,focusIt,stopIt)  {
  if (document.WAFV_Error)  {
	  document.WAFV_Error += "\n" + errorMsg;
  }
  else  {
    document.WAFV_Error = errorMsg;
  }
  if (!document.WAFV_InvalidArray)  {
    document.WAFV_InvalidArray = new Array();
  }
  document.WAFV_InvalidArray[document.WAFV_InvalidArray.length] = formElement;
  if (focusIt && !document.WAFV_Focus)  {
	document.WAFV_Focus = focusIt;
  }
 
  if (stopIt == 1)  {
	document.WAFV_Stop = true;
  }
  else if (stopIt == 2)  {
	formElement.WAFV_Continue = true;
  }
  else if (stopIt == 3)  {
	formElement.WAFV_Stop = true;
	formElement.WAFV_Continue = false;
  }
}
 
function WAValidateRQ(formElement,errorMsg,focusIt,stopIt,trimWhite,inputType)  {
  var isValid = true;
  if (!document.WAFV_Stop && !formElement.WAFV_Stop)  {
    var value=WAFV_GetValueFromInputType(formElement,inputType,trimWhite);
    if (value == "")  {
	    isValid = false;
    }
  }
  if (!isValid)  {
    WAAddError(formElement,errorMsg,focusIt,stopIt);
  }
}
function WAValidatePN(formElement,errorMsg,areaCode,international,reformat,focusIt,stopIt,required)  {
  var value = formElement.value;
  var isValid = true;
  var allowed = "*() -./_\n\r+";
  var newVal = "";
  if ((!document.WAFV_Stop && !formElement.WAFV_Stop) && !(!required && value==""))  {
    for (var x=0; x<value.length; x++)  {
      var z = value.charAt(x);
      if ((z >= "0") && (z <= "9")) {
	    newVal += z;
	  }
	  else  {
		if (allowed.indexOf(z) < 0)  {
		  isValid = false;
		}
	  }
    }	
	if (international)  {
	  if  (newVal.length < 5)  {
	    isValid = false;
	  }
	}
	else if (newVal.length == 11)  {
	  if (newVal.charAt(0) != "1")	{
		isValid = false;
	  }
	}
	else if ((newVal.length != 10 && newVal.length != 7) || (newVal.length==7 && areaCode)) {
	  isValid = false;
	}
  }
  if (!isValid)  {
    WAAddError(formElement,errorMsg,focusIt,stopIt);
  }
  else  {
    formElement.WAValid = true;
    if (reformat != "" && newVal != "")  {
      for (var x=0; x<newVal.length; x++)  {
	    reformat = reformat.substring(0,reformat.lastIndexOf("x")) + newVal.charAt(newVal.length-(x+1)) + reformat.substring(reformat.lastIndexOf("x")+1);
	  }
	  if (reformat.indexOf("x")>=0)  {
	    reformat = reformat.substring(reformat.lastIndexOf("x")+1);
        z = reformat.charAt(0);
	    while (((z < "0") || (z > "9")) && z != "(")  {
	      reformat = reformat.substring(1);
		  z = reformat.charAt(0);
		}
	  }
      formElement.value = reformat;
	}
  }
}
function WAValidateEM(formElement,value,errorMsg,focusIt,stopIt,required) {
  var isValid = true;
  if ((!document.WAFV_Stop && !formElement.WAFV_Stop) && !(!required && value==""))  {
    value = value.toLowerCase();
    var knownDomsPat = /^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/i;
    var emailPat = /^(.+)@(.+)$/i;
    var accepted = "\[^\\s\\(\\)><@,;:\\\\\\\"\\.\\[\\]\]+";
    var quotedUser = "(\"[^\"]*\")";
    var ipDomainPat = /^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/i;
    var section = "(" + accepted + "|" + quotedUser + ")";
    var userPat = new RegExp("^" + section + "(\\." + section + ")*$");
    var domainPat = new RegExp("^" + accepted + "(\\." + accepted +")*$");
    var theMatch = value.match(emailPat);
    var acceptedPat = new RegExp("^" + accepted + "$");
    var userName = "";
    var domainName = "";
    if (theMatch==null) {
      isValid = false;
    }
    else  {
      userName = theMatch[1];
      domainName = theMatch[2];
	  var domArr = domainName.split(".");
	  var IPArray = domainName.match(ipDomainPat);
      for (x=0; x < userName.length; x++) {
        if ((userName.charCodeAt(x) > 127 && userName.charCodeAt(x) < 192) || userName.charCodeAt(x) > 255) {
          isValid = false;
        }
      }
      for (x=0; x < domainName.length; x++) {
        if ((domainName.charCodeAt(x) > 127 && domainName.charCodeAt(x) < 192) || domainName.charCodeAt(x) > 255) {
          isValid = false;
        }
      }
      if (userName.match(userPat) == null) {
        isValid = false;
      }
      if (IPArray != null) {
        for (var x=1; x<=4; x++) {
          if (IPArray[x] > 255) {
            isValid = false;
          }
        }
      }
      for (x=0; x < domArr.length; x++) {
        if (domArr[x].search(acceptedPat) == -1 || domArr[x].length == 0 || (domArr[x].length < 2 && x >= domArr.length-2  && x > 0)) {
          isValid = false;
        }
      }
      if (domArr[domArr.length-1].length !=2 && domArr[domArr.length-1].search(knownDomsPat) == -1) {
        isValid = false;
      }
      if (domArr.length < 2) {
        isValid = false;
      }
    }
  }
  if (!isValid)  {
    WAAddError(formElement,errorMsg,focusIt,stopIt);
  }
}
function WAValidateZC(formElement,errorMsg,us5,us9,can6,uk,reformat,focusIt,stopIt,required)  {
  var value = formElement.value;
  var isValid = true;
  var allowed = "() -.\n\r";
  var hasLetters = false;
  if ((!document.WAFV_Stop && !formElement.WAFV_Stop) && !(!required && value==""))  {
    var newVal = "";
    var charVal = "";
    for (var x=0; x<value.length; x++)  {
      var z = value.charAt(x);
      if ((z >= "0") && (z <= "9")) {
        newVal += z;
        charVal += "N";
      }
      else  {
        if ((uk || can6) && ((z >= "a") && (z <= "z")) || ((z >= "A") && (z <= "Z"))) {
          charVal += "A";
          hasLetters = true;
        }
        else if (allowed.indexOf(z) < 0 || x==0 || x == value.length-1)  {
          isValid = false;
        }
      }
    }
    if ((uk || can6) && hasLetters)  {
      var acceptPattern = "";
      if (uk)  {
        acceptPattern += ",ANNAA,ANNNAA,AANNAA,AANNNAA,ANANAA,AANANAA,";
      }
      if (can6)  {
        acceptPattern += ",ANANAN,";
      }
      if (String(acceptPattern).indexOf(","+charVal+",") < 0)
        isValid = false;
    }
    if (!((uk && (charVal.length >= 5 &&  charVal.length <= 8)) || (us5 && newVal.length == 5) || (us9 && newVal.length == 9) || (can6 && charVal.length == 6)))  {
      isValid = false;
    }
    if (isValid && !hasLetters && (us5 || us9)) {
      if (us5) {
        isValid = (value.search(/^\d{5}$/) == 0);
      }
      if (us9 && ((us5 && !isValid) || !us5)) {
        isValid = ((value.search(/^\d{5}[-\. ]\d{4}$/) == 0) || (value.search(/^\d{9}$/) == 0));
      }
    }
  }
  if (!isValid)  {
    WAAddError(formElement,errorMsg,focusIt,stopIt);
  }
  else  {
    if (reformat != "")  {
      if (reformat != "t")  {
        for (var x=0; x<newVal.length; x++)  {
          reformat = reformat.substring(0,reformat.indexOf("x")) + newVal.charAt(x) + reformat.substring(reformat.indexOf("x")+1);
        }
        if (reformat.indexOf("x")>=0)  {
          reformat = reformat.substring(0,reformat.indexOf("x"));
          while (reformat.charAt(reformat.length-1) == " " || reformat.charAt(reformat.length-1) == "-")
            reformat = reformat.substring(0,reformat.length-1);
          z = reformat.charAt(reformat.length-1);
        }
        if (newVal.length==6)
          reformat = reformat.replace(/-/,"");
      }
      else  {
        newVal = formElement.value;
        while (newVal.charAt(0) == " ")
          newVal = newVal.substring(1);
        while (newVal.charAt(newVal.length-1) == " ")
          newVal = newVal.substring(0,newVal.length-1);
        reformat = newVal;
      }
      formElement.value = reformat;
    }
  }
}
function WA_isCreditCard(st) {
  if (st == 0)
    return (false);
 
  if (st.length > 19)
    return (false);
 
  sum = 0; mul = 1; l = st.length;
  for (i = 0; i < l; i++) {
    digit = st.substring(l-i-1,l-i);
    tproduct = parseInt(digit ,10)*mul;
    if (tproduct >= 10)
      sum += (tproduct % 10) + 1;
    else
      sum += tproduct;
    if (mul == 1)
      mul++;
    else
      mul--;
  }
 
  if ((sum % 10) == 0)
    return (true);
  else
    return (false);
 
}
 
function WAValidateCC(formElement,value,errorMsg,format,allow,focusIt,stopIt,required)  {
  var isValid = true;
  var accepted = "\r\n\t.- ";
  if ((!document.WAFV_Stop && !formElement.WAFV_Stop) && !(!required && value==""))  {
    var stripVal = "";
	for (var x=0; x<value.length; x++)  {
	  if (value.charCodeAt(x)>=48 && value.charCodeAt(x)<=57)
	    stripVal += value.charAt(x);
	  else if (accepted.indexOf(value.charAt(x))<0)  {
	    isValid = false;
	  }
	}
	if (isValid)  {
	  if (allow!="")  {
	    isValid = false;
	    allow = allow.split(":");
		for (var y=0; y<allow.length-1 && !isValid; y++)  {
		  if (stripVal.indexOf(allow[y])==0)
		    isValid = true;
		}
	  }
	}
	if (isValid)  {
	  isValid = WA_isCreditCard(stripVal);
	}
	if (isValid && format!="")  {
	  var newFormat = "";
	  while (format!="")  {
	    if (format.charAt(0) == "x") {
		  newFormat += stripVal.charAt(0);
		  stripVal = stripVal.substring(1);
		}
		else  {
		  newFormat += format.charAt(0);
		}
		format = format.substring(1);
	  }
	  formElement.value = newFormat;
	}
  }
  if (!isValid)  {
    WAAddError(formElement,errorMsg,focusIt,stopIt);
  }
}
function WAAlertErrors(errorHead,errorFoot,setFocus,submitForm)  { 
  if (!document.WAFV_StopAlert)  { 
	  document.WAFV_StopAlert = true;
	  if (document.WAFV_InvalidArray)  {  
	    document.WAFV_Stop = true;
        var errorMsg = document.WAFV_Error;
	    if (errorHead!="")
		  errorMsg = errorHead + "\n" + errorMsg;
		if (errorFoot!="")
		  errorMsg += "\n" + errorFoot;
		document.MM_returnValue = false;
		if (document.WAFV_Error!="")
		  alert(errorMsg.replace(/&quot;/g,'"'));
		else if (submitForm)
		  submitForm.submit();
	    if (setFocus && document.WAFV_Focus)  {
		  document.tempFocus = document.WAFV_Focus;
          setTimeout("document.tempFocus.focus();setTimeout('document.WAFV_Stop = false;document.WAFV_StopAlert = false;',1)",1); 
        }
        else {
          document.WAFV_Stop = false;
          document.WAFV_StopAlert = false;
        }
        for (var x=0; x<document.WAFV_InvalidArray.length; x++)  {
	      document.WAFV_InvalidArray[x].WAFV_Stop = false;
	    }
	  }
	  else  {
        document.WAFV_Stop = false;
        document.WAFV_StopAlert = false;
	    if (submitForm)  {
	      submitForm.submit();
	    }
	    document.MM_returnValue = true;
	  }
      document.WAFV_Focus = false;
	  document.WAFV_Error = false;
	  document.WAFV_InvalidArray = false;
  }
}
//-->
</script>
<style type="text/css">
<!--
.smallNote {font-size: 9px}
-->
</style>
</head>
 
<body>
 
<div id="container">
  <div align="center"><img src="images/payment_strip1.jpg" alt="Step 1: Payment Information" width="500" height="114" />
    <!--end of navbar-->
  </div>
  <div id="white_container">
    <form action="" method="post" name="CheckoutInfo" id="CheckoutInfo" onsubmit="WAValidateRQ(document.CheckoutInfo.PayerFirstName,'- First Name is required',document.CheckoutInfo.PayerFirstName,0,false,'text');WAValidateRQ(document.CheckoutInfo.PayerLastName,'- Last Name is required',document.CheckoutInfo.PayerLastName,0,false,'text');WAValidatePN(document.CheckoutInfo.PayerPhoneNumber,'- Invalid Phone Number',false,true,'x-xxx-xxx-xxxx',document.CheckoutInfo.PayerPhoneNumber,0,true);WAValidateEM(document.CheckoutInfo.PayerEmailAddress,document.CheckoutInfo.PayerEmailAddress.value,'- Invalid email address',document.CheckoutInfo.PayerEmailAddress,0,true);WAValidateRQ(document.CheckoutInfo.PayerStreetAddress1,'- Billing Street 1 is required',document.CheckoutInfo.PayerStreetAddress1,0,false,'text');WAValidateRQ(document.CheckoutInfo.PayerCity,'- Billing City is required',document.CheckoutInfo.PayerCity,0,false,'text');WAValidateRQ(document.CheckoutInfo.PayerState,'- Billing State is required',document.CheckoutInfo.PayerState,0,false,'text');WAValidateZC(document.CheckoutInfo.PayerPostalCode,'- Invalid Billing postal code',true,true,true,true,'',document.CheckoutInfo.PayerPostalCode,0,true);WAValidateCC(document.CheckoutInfo.CreditCardNumber,document.CheckoutInfo.CreditCardNumber.value,'- Invalid credit card number','','4:51:52:53:54:55:34:37:',document.CheckoutInfo.CreditCardNumber,0,true);WAValidateRQ(document.CheckoutInfo.CreditCardCVV2,'- Credit Card Security Digits are  required',document.CheckoutInfo.CreditCardCVV2,0,false,'text');WAValidateRQ(document.CheckoutInfo.ShipToFirstName,'- Shipping First Name is required.',document.CheckoutInfo.ShipToFirstName,0,false,'text');WAValidateRQ(document.CheckoutInfo.ShipToLastName,'- Shipping Last Name is required.',document.CheckoutInfo.ShipToLastName,0,false,'text');WAValidatePN(document.CheckoutInfo.ShipPhoneNumber,'- Invalid Shipping Phone Number',false,true,'x-xxx-xxx-xxxx',document.CheckoutInfo.ShipPhoneNumber,0,true);WAValidateRQ(document.CheckoutInfo.ShipStreet1,'- Shipping Street1 is required.',document.CheckoutInfo.ShipStreet1,0,false,'text');WAValidateRQ(document.CheckoutInfo.ShipCity,'- Shipping City is required.',document.CheckoutInfo.ShipCity,0,false,'text');WAValidateRQ(document.CheckoutInfo.ShipState,'- Shipping State is required.',document.CheckoutInfo.ShipState,0,false,'text');WAValidateZC(document.CheckoutInfo.ShipPostalCode,'- Invalid Shipping postal code',true,true,true,true,'',document.CheckoutInfo.ShipPostalCode,0,true);WAValidateRQ(document.CheckoutInfo.PayerCountry,'- Billing Country  is required.',document.CheckoutInfo.PayerCountry,0,true,'select');WAValidateRQ(document.CheckoutInfo.CreditCardType,'- Credit Card Type is required.',document.CheckoutInfo.CreditCardType,0,true,'select');WAValidateRQ(document.CheckoutInfo.CreditCardExpMonth,'- Credit Card Exp Month is required.',document.CheckoutInfo.CreditCardExpMonth,0,true,'select');WAValidateRQ(document.CheckoutInfo.CreditCardExpYear,'- Credit Card Exp Year is required.',document.CheckoutInfo.CreditCardExpYear,0,true,'select');WAValidateRQ(document.CheckoutInfo.ShipCountry,'- Shipping Country is required.',document.CheckoutInfo.ShipCountry,0,true,'select');WAAlertErrors('The following errors were found','Correct invalid entries to continue',true,false);return document.MM_returnValue; DisableSubmitButton('SubmitButton');">
      <p>&nbsp;</p>
      <table width="514" border="0" align="center" cellpadding="2" cellspacing="2" class="eC_Clean_Pacifica_Arial">
        <tr>
          <td colspan="2" class="eC_InfoHeader"><strong>Billing Information</strong></td>
        </tr>
        
        <tr>
          <td><strong>Company Name</strong></td>
          <td><input name="PayerCompany" type="text" id="PayerCompany" value="<?php if(isset($_SESSION['CustomerData']['company_name'])) echo $_SESSION['CustomerData']['company_name']; ?>" size="25" maxlength="100" /></td>
        </tr>
        <tr>
          <td><strong>First Name *</strong></td>
          <td><input name="PayerFirstName" type="text" id="PayerFirstName" value="<?php if(isset($_SESSION['CustomerData']['first_name'])) echo $_SESSION['CustomerData']['first_name']; ?>" size="25" maxlength="100" /></td>
        </tr>
        <tr>
          <td><strong>Last Name *</strong></td>
          <td><input name="PayerLastName" type="text" id="PayerLastName" value="<?php if(isset($_SESSION['CustomerData']['last_name'])) echo $_SESSION['CustomerData']['last_name']; ?>" size="25" maxlength="25" /></td>
        </tr>
        <tr>
          <td width="184"><strong>Phone Number *</strong></td>
          <td width="316"><input name="PayerPhoneNumber" type="text" id="PayerPhoneNumber" value="<?php if(isset($_SESSION['CustomerData']['phone_number'])) echo $_SESSION['CustomerData']['phone_number']; ?>" size="25" maxlength="25" /></td>
        </tr>
        <tr>
          <td><strong>Email Address</strong> *</td>
          <td><input name="PayerEmailAddress" type="text" id="PayerEmailAddress" value="<?php if(isset($_SESSION['CustomerData']['email_address'])) echo $_SESSION['CustomerData']['email_address']; ?>" size="25" maxlength="50" /></td>
        </tr>
        <tr>
          <td><strong>Street Address 1 *</strong></td>
          <td><input name="PayerStreetAddress1" type="text" id="PayerStreetAddress1" value="<?php if(isset($_SESSION['CustomerData']['billing_address1'])) echo $_SESSION['CustomerData']['billing_address1']; ?>" size="25" maxlength="50" /></td>
        </tr>
        <tr>
          <td><strong>Street Address 2</strong></td>
          <td><input name="PayerStreetAddress2" type="text" id="PayerStreetAddress2" value="<?php if(isset($_SESSION['CustomerData']['billing_address2'])) echo $_SESSION['CustomerData']['billing_address2']; ?>" size="25" maxlength="50" /></td>
        </tr>
        <tr>
          <td><strong>City *</strong></td>
          <td><input name="PayerCity" type="text" id="PayerCity" value="<?php if(isset($_SESSION['CustomerData']['billing_city'])) echo $_SESSION['CustomerData']['billing_city']; ?>" size="25" maxlength="25" /></td>
        </tr>
        <tr>
          <td><strong>State / Province *</strong></td>
          <td><input name="PayerState" type="text" id="PayerState" value="<?php if(isset($_SESSION['CustomerData']['billing_state'])) echo $_SESSION['CustomerData']['billing_state']; ?>" size="2" maxlength="2" /></td>
        </tr>
        <tr>
          <td><strong>Postal Code *</strong></td>
          <td><input name="PayerPostalCode" type="text" id="PayerPostalCode" value="<?php if(isset($_SESSION['CustomerData']['billing_postal_code'])) echo $_SESSION['CustomerData']['billing_postal_code']; ?>" size="6" maxlength="10" /></td>
        </tr>
        <tr>
          <td><strong>Country *</strong></td>
          <td><select name="PayerCountry" id="PayerCountry">
              <option value="US" <?php if(isset($_SESSION['CustomerData']['billing_country_code']) && $_SESSION['CustomerData']['billing_country_code'] == 'US') echo 'selected="selected"'; ?>>United States of America</option>
              <option value="CA" <?php if(isset($_SESSION['CustomerData']['billing_country_code']) && $_SESSION['CustomerData']['billing_country_code'] == 'CA') echo 'selected="selected"'; ?>>Canada</option>
              <option value="GB" <?php if(isset($_SESSION['CustomerData']['billing_country_code']) && $_SESSION['CustomerData']['billing_country_code'] == 'GB') echo 'selected="selected"'; ?>>United Kingdon</option>
          </select></td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td><strong>Credit Card Type *</strong></td>
          <td><select name="CreditCardType" id="CreditCardType">
              <option value="Visa" <?php if(isset($_SESSION['CreditCardType']) && $_SESSION['CreditCardType'] == 'Visa') echo 'selected="selected"'; ?>>Visa</option>
              <option value="Mastercard" <?php if(isset($_SESSION['CreditCardType']) && $_SESSION['CreditCardType'] == 'Mastercard') echo 'selected="selected"'; ?>>Mastercard</option>
              <option value="American Express" <?php if(isset($_SESSION['CreditCardType']) && $_SESSION['CreditCardType'] == 'American Express') echo 'selected="selected"'; ?>>American Express</option>
          </select></td>
        </tr>
        <tr>
          <td><strong>Credit Card Number *</strong></td>
          <td><input name="CreditCardNumber" type="text" id="CreditCardNumber" value="<?php if(isset($_SESSION['CreditCardNumber'])) echo $_SESSION['CreditCardNumber']; ?>" size="25" maxlength="25" /></td>
        </tr>
        <tr>
          <td><strong>Credit Card Exp. Date *</strong></td>
          <td><select name="CreditCardExpMonth" id="CreditCardExpMonth">
              <option <?php if(!isset($_SESSION['CreditCardExpMonth'])) echo 'selected="selected"'; ?>>Month...</option>
              <option value="01" <?php if(isset($_SESSION['CreditCardExpMonth']) && $_SESSION['CreditCardExpMonth'] == '01') echo 'selected="selected"'; ?>>January</option>
              <option value="02" <?php if(isset($_SESSION['CreditCardExpMonth']) && $_SESSION['CreditCardExpMonth'] == '02') echo 'selected="selected"'; ?>>February</option>
              <option value="03" <?php if(isset($_SESSION['CreditCardExpMonth']) && $_SESSION['CreditCardExpMonth'] == '03') echo 'selected="selected"'; ?>>March</option>
              <option value="04" <?php if(isset($_SESSION['CreditCardExpMonth']) && $_SESSION['CreditCardExpMonth'] == '04') echo 'selected="selected"'; ?>>April</option>
              <option value="05" <?php if(isset($_SESSION['CreditCardExpMonth']) && $_SESSION['CreditCardExpMonth'] == '05') echo 'selected="selected"'; ?>>May</option>
              <option value="06" <?php if(isset($_SESSION['CreditCardExpMonth']) && $_SESSION['CreditCardExpMonth'] == '06') echo 'selected="selected"'; ?>>June</option>
              <option value="07" <?php if(isset($_SESSION['CreditCardExpMonth']) && $_SESSION['CreditCardExpMonth'] == '07') echo 'selected="selected"'; ?>>July</option>
              <option value="08" <?php if(isset($_SESSION['CreditCardExpMonth']) && $_SESSION['CreditCardExpMonth'] == '08') echo 'selected="selected"'; ?>>August</option>
              <option value="09" <?php if(isset($_SESSION['CreditCardExpMonth']) && $_SESSION['CreditCardExpMonth'] == '09') echo 'selected="selected"'; ?>>September</option>
              <option value="10" <?php if(isset($_SESSION['CreditCardExpMonth']) && $_SESSION['CreditCardExpMonth'] == '10') echo 'selected="selected"'; ?>>October</option>
              <option value="11" <?php if(isset($_SESSION['CreditCardExpMonth']) && $_SESSION['CreditCardExpMonth'] == '11') echo 'selected="selected"'; ?>>November</option>
              <option value="12" <?php if(isset($_SESSION['CreditCardExpMonth']) && $_SESSION['CreditCardExpMonth'] == '12') echo 'selected="selected"'; ?>>December</option>
            </select>
              <select name="CreditCardExpYear" id="CreditCardExpYear">
                <option <?php if(!isset($_SESSION['CreditCardExpYear'])) echo 'selected="selected"'; ?>>Year...</option>
                <option value="2008" <?php if(isset($_SESSION['CreditCardExpYear']) && $_SESSION['CreditCardExpYear'] == '2008') echo 'selected="selected"'; ?>>2008</option>
                <option value="2009" <?php if(isset($_SESSION['CreditCardExpYear']) && $_SESSION['CreditCardExpYear'] == '2009') echo 'selected="selected"'; ?>>2009</option>
                <option value="2010" <?php if(isset($_SESSION['CreditCardExpYear']) && $_SESSION['CreditCardExpYear'] == '2010') echo 'selected="selected"'; ?>>2010</option>
                <option value="2011" <?php if(isset($_SESSION['CreditCardExpYear']) && $_SESSION['CreditCardExpYear'] == '2011') echo 'selected="selected"'; ?>>2011</option>
                <option value="2012" <?php if(isset($_SESSION['CreditCardExpYear']) && $_SESSION['CreditCardExpYear'] == '2012') echo 'selected="selected"'; ?>>2012</option>
                <option value="2013" <?php if(isset($_SESSION['CreditCardExpYear']) && $_SESSION['CreditCardExpYear'] == '2013') echo 'selected="selected"'; ?>>2013</option>
                <option value="2014" <?php if(isset($_SESSION['CreditCardExpYear']) && $_SESSION['CreditCardExpYear'] == '2014') echo 'selected="selected"'; ?>>2014</option>
                <option value="2015" <?php if(isset($_SESSION['CreditCardExpYear']) && $_SESSION['CreditCardExpYear'] == '2015') echo 'selected="selected"'; ?>>2015</option>
            </select></td>
        </tr>
        <tr>
          <td><strong>Credit Card Security Digits *</strong></td>
          <td><input name="CreditCardCVV2" type="text" id="CreditCardCVV2" value="<?php if(isset($_SESSION['CreditCardCVV2'])) echo $_SESSION['CreditCardCVV2']; ?>" size="4" maxlength="4" /></td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td colspan="2" class="eC_InfoHeader"><strong>Shipping Information</strong></td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td><em>
            <input name="sameAsBilling" onclick="javascript:ShipToBillPerson(this.form);" type="checkbox" id="sameAsBilling" value="checkbox" />
            Same as Billing</em></td>
        </tr>
        <tr>
          <td><strong>Company Name</strong></td>
          <td><input name="ShipCompany" type="text" id="ShipCompany" size="25" maxlength="100" /></td>
        </tr>
        <tr>
          <td><strong>First Name *</strong></td>
          <td><input name="ShipToFirstName" type="text" id="ShipToFirstName" value="<?php if(isset($_SESSION['CustomerData']['first_name'])) echo $_SESSION['CustomerData']['first_name']; ?>" size="25" maxlength="25" /></td>
        </tr>
        <tr>
          <td><strong>Last Name *</strong></td>
          <td><input name="ShipToLastName" type="text" id="ShipToLastName" value="<?php if(isset($_SESSION['CustomerData']['last_name'])) echo $_SESSION['CustomerData']['last_name']; ?>" size="25" maxlength="25" /></td>
        </tr>
        <tr>
          <td><strong>Phone Number *</strong></td>
          <td><input name="ShipPhoneNumber" type="text" id="ShipPhoneNumber" value="<?php if(isset($_SESSION['InvoiceData']['shipping_phone'])) echo $_SESSION['InvoiceData']['shipping_phone']; ?>" size="18" maxlength="15" /></td>
        </tr>
        <tr>
          <td><strong>Street Address 1 *</strong></td>
          <td><input name="ShipStreet1" type="text" id="ShipStreet1" value="<?php if(isset($_SESSION['InvoiceData']['address_street1'])) echo $_SESSION['InvoiceData']['address_street1']; ?>" size="25" maxlength="25" /></td>
        </tr>
        <tr>
          <td><strong>Street Address 2</strong></td>
          <td><input name="ShipStreet2" type="text" id="ShipStreet2" value="<?php if(isset($_SESSION['InvoiceData']['address_street2'])) echo $_SESSION['InvoiceData']['address_street2']; ?>" size="25" maxlength="25" /></td>
        </tr>
        <tr>
          <td><strong>City *</strong></td>
          <td><input name="ShipCity" type="text" id="ShipCity" value="<?php if(isset($_SESSION['InvoiceData']['address_city'])) echo $_SESSION['InvoiceData']['address_city']; ?>" size="25" maxlength="25" /></td>
        </tr>
        <tr>
          <td><strong>State / Province *</strong></td>
          <td><input name="ShipState" type="text" id="ShipState" value="<?php if(isset($_SESSION['InvoiceData']['address_state'])) echo $_SESSION['InvoiceData']['address_state']; ?>" size="2" maxlength="2" /></td>
        </tr>
        <tr>
          <td><strong>Postal Code *</strong></td>
          <td><input name="ShipPostalCode" type="text" id="ShipPostalCode" value="<?php if(isset($_SESSION['InvoiceData']['address_zip'])) echo $_SESSION['InvoiceData']['address_zip']; ?>" size="6" maxlength="10" /></td>
        </tr>
        <tr>
          <td><strong>Country *</strong></td>
          <td><select name="ShipCountry" id="ShipCountry">
              <option value="US" <?php if(isset($_SESSION['InvoiceData']['address_country']) && $_SESSION['InvoiceData']['address_country'] == 'US') echo 'selected="selected"'; ?>>United States of America</option>
              <option value="CA" <?php if(isset($_SESSION['InvoiceData']['address_country']) && $_SESSION['InvoiceData']['address_country'] == 'CA') echo 'selected="selected"'; ?>>Canada</option>
              <option value="GB" <?php if(isset($_SESSION['InvoiceData']['address_country']) && $_SESSION['InvoiceData']['address_country'] == 'GB') echo 'selected="selected"'; ?>>United Kingdon</option>
          </select></td>
        </tr>
        <tr>
          <td><strong>Preferred Delivery Date?<br />
            <span class="smallNote">(Items will be available for shipping on 12/1/2008)</span></strong></td>
          <td><label>
            <input name="PreferredDeliveryDate" type="text" id="PreferredDeliveryDate" value="<?php if(isset($_SESSION['PreferredDeliveryDate'])) echo $_SESSION['PreferredDeliveryDate']; else echo '12/08/2008'; ?>" size="15" maxlength="50" />
          </label></td>
        </tr>
        
        <!--<tr>
          <td class="eC_SummaryLabel"><strong>Saturday Delivery </strong></td>
          <td><input name="SaturdayDelivery" type="checkbox" value="1" id="SaturdayDelivery" <?php if(isset($_SESSION['FedExSaturdayDelivery']) && $_SESSION['FedExSaturdayDelivery'] == '1') echo 'checked="checked"'; ?> /></td>
        </tr>-->
        <tr>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td colspan="2" class="eC_InfoHeader"><strong>Notes</strong></td>
        </tr>
        <tr>
          <td colspan="2" class="eC_SummaryLabel"> Please make a note if you would like The Sea Turtle Restoration Project to receive your 10% donation 
instead of Feed the Children, or any additional notes below:<br /><textarea class="text_area_font" name="CustomerNotes" id="CustomerNotes" cols="90" rows="10"></textarea></td>
        </tr>
        <tr>
          <td colspan="2" align="center">&nbsp;</td>
        </tr>
        <tr>
          <td align="center">&nbsp;</td>
          <td><input type="submit" name="Submit" id="SubmitCheckout" value="Next - Review Order" />
              <input type="reset" name="Reset" id="button" value="Clear Form" /></td>
        </tr>
      </table>
    </form>
    <p>&nbsp;</p>
  </div>
</div> 
<!--end container div-->
<p class="highlighted_text">&nbsp;</p>
<p align="center" class="footer">&copy; 2008 All Rights Reserved <br /> 
Designed by <a href="http://perfectfitweb.com" target="_blank">Perfect Fit Web Design </a></p>
<p class="highlighted_text">&nbsp;</p>
</body>
</html>

Open in new window

Bumped up the points for ya to wade through that.  :)
Uhh, yeah, maybe you should just use the solution with the timeout... That's some pretty serious form validation.
Solution with the timeout?

Why does IE have to suck so badly!!!
onclick="window.setTimeout('document.getElementById(\"' + this.id + '\").disabled=true', 250)"

This will basically make the event fire after the onSubmit fires. But this doesn't take into consideration your form validation. If the form does not validate, the submit button will still be disabled.
I'm getting syntax errors with that..??