title: Form validation without error on IE
body: <p>I have a html code saved as a php, the form validation works in google chrome but not in IE. In IE after I hit the submit button, the page automatically goes to process form regardless of errors.</p>
  
  <p>This is my code:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
      &lt;head&gt;
          &lt;title&gt;Week 8 Lab - JavaScript DOM and Arrays&lt;/title&gt;
          &lt;meta charset="utf-8"&gt;
          &lt;link href="css/style.css" rel="stylesheet"&gt;
      &lt;/head&gt;
      &lt;body&gt;
    &lt;script&gt;
      function validateForm() {
          var errors = 0;
          var fName = document.forms["orderForm"].firstName.value;//first name validation
          if (fName == null || fName == "")
          {
              document.getElementById('firstNameError').innerHTML = "Please enter a first name.";
              errors++;
          } else {
              document.getElementById('firstNameError').innerHTML = "";
          }
  
  
          //var lName = document.forms["orderForm"].lastName.value;//last name validation
          if (lName == null || lName == "")
          {
              document.getElementById('lastNameError').innerHTML = "Please enter a last name.";
              errors++;
          } else {
              document.getElementById('lastNameError').innerHTML = "";
          }
  
  
          //var address = document.forms["orderForm"].address.value;//address validation
          if (address == null || address == "")
          {
              document.getElementById('addressError').innerHTML = "Please enter an address.";
              errors++;
          } else {
              document.getElementById('addressError').innerHTML = "";
          }
  
  
          //var city = document.forms["orderForm"].city.value;//city validation
          if (city == null || city == "")
          {
              document.getElementById('cityError').innerHTML = "Please enter a city.";
              errors++;
          } else {
              document.getElementById('cityError').innerHTML = "";
          }
  
  
          //var pCodeCheck = /^[0-9a-zA-Z]+$/;//postal code validation
          if (pCodeCheck)
          {
              document.getElementById('postalCoderror').innerHTML = "";
          }
          else
          {
  
              document.getElementById('postalCoderror').innerHTML = "Please enter a valid postal code.";
              errors++;
          }
  
          // makes sure you cannot order a negative number of items
  
  
          var itemQTY = document.forms["orderForm"].widget1qty.value;
          if (itemQTY &lt; 0)
          {
              document.getElementById('qtyError').innerHTML = "You cannot enter a negative number.";
              errors++;
          } else {
              document.getElementById('qtyError').innerHTML = "";
          }
  
  
          var itemQTY2 = document.forms["orderForm"].widget2qty.value;
          if (itemQTY2 &lt; 0)
          {
              document.getElementById('qtyError2').innerHTML = "You cannot enter a negative number.";
              errors++;
          } else {
              document.getElementById('qtyError2').innerHTML = "";
          }
  
  
          var itemQTY3 = document.forms["orderForm"].widget3qty.value;
          if (itemQTY3 &lt; 0)
          {
              document.getElementById('qtyError3').innerHTML = "You cannot enter a negative number.";
              errors++;
          } else {
              document.getElementById('qtyError3').innerHTML = "";
          }
  
          //makes sure there is at least one item ordered
          var wid1Qty = document.getElementById('widget1qty').value;
          var wid2Qty = document.getElementById('widget2qty').value;
          var wid3Qty = document.getElementById('widget3qty').value;
          if (wid1Qty + wid2Qty + wid3Qty == 0)
          {
              document.getElementById('itemQTY').innerHTML = "You must order atleast one item.";
              errors++;
          } else {
              document.getElementById('itemQTY').innerHTML = "";
          }
          var total1;
          var total2;
          var total3;
          var total4;
  
          total1 = document.forms['orderForm']['widget1qty'].value * 5;
          total2 = document.forms['orderForm']['widget2qty'].value * 15;
          total3 = document.forms['orderForm']['widget3qty'].value * 25;
          total4 = (total1 + total2 + total3);
          alert('Your total is: $' + total4 + '.00');
          return errors;
      }
  
      function startValidate() {
          var errors = validateForm();
          if (errors == 0) {
              document.forms['orderForm'].submit();
          } else {
              return false;
          }
      }
  &lt;/script&gt;
          &lt;div id="wrapper"&gt;
              &lt;h2 class="center"&gt;Order Form&lt;/h2&gt; &lt;!-- action="processForm.html"       "javascript:void(0)" --&gt;
              &lt;form name="orderForm" method="post" action="processForm.html" onsubmit="return startValidate()"&gt;
                  &lt;fieldset&gt;
                      &lt;legend&gt;Personal Information&lt;/legend&gt;
                      &lt;table&gt;
  
                          &lt;tr&gt;
                              &lt;th colspan="3"&gt;&lt;/th&gt;
                          &lt;/tr&gt;
                          &lt;tr&gt;
                              &lt;td&gt;&lt;span class="required"&gt;*&lt;/span&gt;First Name:&lt;/td&gt;
                              &lt;td&gt;&lt;input type="text" name="firstName" id="firstName" size="30"&gt;&lt;/td&gt;
                              &lt;td id="firstNameError"&gt;&lt;/td&gt;
                          &lt;/tr&gt;
                          &lt;tr&gt;
                              &lt;td&gt;&lt;span class="required"&gt;*&lt;/span&gt;Last Name:&lt;/td&gt;
                              &lt;td&gt;&lt;input type="text" name="lastName" id="lastName" size="30"&gt;&lt;/td&gt;
                              &lt;td id="lastNameError"&gt;&lt;/td&gt;
                          &lt;/tr&gt;
                          &lt;tr&gt;
                              &lt;td&gt;&lt;span class="required"&gt;*&lt;/span&gt;Address:&lt;/td&gt;
                              &lt;td&gt;&lt;input type="text" name="address" id="address" size="30"&gt;&lt;/td&gt;
                              &lt;td id="addressError"&gt;&lt;/td&gt;
                          &lt;/tr&gt;
                          &lt;tr&gt;
                              &lt;td&gt;&lt;span class="required"&gt;*&lt;/span&gt;City:&lt;/td&gt;
                              &lt;td&gt;&lt;input type="text" name="city" id="city" size="30"&gt;&lt;/td&gt;
                              &lt;td id="cityError"&gt;&lt;/td&gt;
                          &lt;/tr&gt;
                          &lt;tr&gt;
                              &lt;td&gt;&lt;span class="required"&gt;*&lt;/span&gt;Province:&lt;/td&gt;
                              &lt;td&gt;&lt;select name="province" id="province" size="1"&gt;
                                      &lt;option disabled&gt;Select a province&lt;/option&gt;
                                      &lt;option value="BC"&gt;British Columbia&lt;/option&gt;
                                      &lt;option value="AB"&gt;Alberta&lt;/option&gt;
                                      &lt;option value="SK"&gt;Saskatchewan&lt;/option&gt;
                                      &lt;option value="MB"&gt;Manitoba&lt;/option&gt;
                                      &lt;option value="ON"&gt;Ontario&lt;/option&gt;
                                      &lt;option value="QC"&gt;Quebec&lt;/option&gt;
                                      &lt;option value="NB"&gt;New Brunswick&lt;/option&gt;
                                      &lt;option value="NS"&gt;Nova Scotia&lt;/option&gt;
                                      &lt;option value="PE"&gt;Prince Edward Island&lt;/option&gt;
                                      &lt;option value="NF"&gt;Newfoundland&lt;/option&gt;
                                      &lt;option value="YK"&gt;Yukon&lt;/option&gt;
                                      &lt;option value="NWT"&gt;Northwest Territories&lt;/option&gt;
                                      &lt;option value="NU"&gt;Nunavut&lt;/option&gt;
                                  &lt;/select&gt;
                              &lt;/td&gt;
                              &lt;td&gt;&lt;/td&gt;
                          &lt;/tr&gt;
                          &lt;tr&gt;
                              &lt;td&gt;&lt;span class="required"&gt;*&lt;/span&gt;Postal Code:&lt;/td&gt;
                              &lt;td&gt;&lt;input type="text" name="postalCode" id="postalCode" maxlength="6"&gt;&lt;/td&gt;
                              &lt;td id="postalCoderror"&gt;&lt;/td&gt;
                          &lt;/tr&gt;
                      &lt;/table&gt;
                  &lt;/fieldset&gt;
                  &lt;fieldset&gt;
                      &lt;legend&gt;Order Information&lt;/legend&gt;
  
                      &lt;table&gt;
                          &lt;tr&gt;
                              &lt;th colspan="3"&gt;&lt;/th&gt;
                          &lt;/tr&gt;
                          &lt;tr&gt;
                              &lt;td rowspan="3"&gt;Select your products:&lt;br&gt;
                              &lt;td&gt;Widget #1&amp;nbsp;
                                  &lt;input type="text" name="widget1qty" id="widget1qty" size="1" value="0"&gt;Qty @ &lt;strong&gt;$5.00/ea&lt;/strong&gt;&lt;/td&gt;
                              &lt;td id="qtyError"&gt;&lt;/td&gt;
                          &lt;/tr&gt;
                          &lt;tr&gt;
                              &lt;td&gt;Widget #2&amp;nbsp;
                                  &lt;input type="text" name="widget2qty" id="widget2qty" size="1" value="0"&gt;Qty @ &lt;strong&gt;$15.00/ea&lt;/strong&gt;&lt;/td&gt;
                              &lt;td id="qtyError2"&gt;&lt;/td&gt;
                          &lt;/tr&gt;
                          &lt;tr&gt;
                              &lt;td&gt;Widget #3&amp;nbsp;
                                  &lt;input type="text" name="widget3qty" id="widget3qty" size="1" value="0"&gt;Qty @ &lt;strong&gt;$25.00/ea&lt;/strong&gt;&lt;/td&gt;
                              &lt;td id="qtyError3"&gt;&lt;/td&gt;
                          &lt;/tr&gt;
                          &lt;tr&gt;
                              &lt;td rowspan="3"&gt;&lt;/td&gt;
                              &lt;td&gt;&lt;/td&gt;
                              &lt;td id="itemQTY"&gt;&lt;/td&gt;
                          &lt;/tr&gt;
  
                          &lt;tr&gt;
                              &lt;td rowspan="3"&gt;Shipping Type:&lt;/td&gt;
                              &lt;td&gt;Standard ($5.00)&lt;input type="radio" name="shippingType" id="shippingTypeStandard" value="Standard" checked&gt;&lt;/td&gt;
  
                          &lt;/tr&gt;
                          &lt;tr&gt;
                              &lt;td&gt;Express ($10.00)&lt;input type="radio" name="shippingType" id="shippingTypeExpress" value="Express"&gt;&lt;/td&gt;
                          &lt;/tr&gt;
                          &lt;tr&gt;
                              &lt;td&gt;Overnight ($20.00)&lt;input type="radio" name="shippingType" id="shippingTypeOvernight" value="Overnight"&gt;&lt;/td&gt;
                          &lt;/tr&gt;
  
                      &lt;/table&gt;
                  &lt;/fieldset&gt;
                  &lt;fieldset&gt;
                      &lt;legend&gt;Submit Order&lt;/legend&gt;
                      &lt;table&gt;
                          &lt;tr&gt;
                              &lt;th colspan="2"&gt;&lt;/th&gt;
                          &lt;/tr&gt;
                          &lt;tr&gt;
                          &lt;input type="submit" name="btnSubmit" id="btnSubmit" value="Submit Order"&gt;
                          &lt;td&gt;&lt;input type="reset" name="btnReset" id="btnReset" value="Reset Form"&gt;&lt;/td&gt;
                          &lt;/tr&gt;
                      &lt;/table&gt;
                  &lt;/fieldset&gt;
              &lt;/form&gt;
          &lt;/div&gt;  
      &lt;/body&gt;
  </code></pre>