title: unable to submit form with javascript
body: <p>I'm getting submit is not a function when I try to submit this form.</p>
  
  <p>It was suggested that if the submit button is named submit it will override the submit().  In the original there was no name assigned to the submit button.  I changed that to name='notSubmit' but I still get the same error.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var desktop=true;
             
          
              function nextPage(){
                  
                  var minCap = document.getElementById('minCap');
                  minCap.style.display='none';
                 
                 
                  var top = document.getElementById('top');
                  top.style.display='none';
                  var middle = document.getElementById('middle');
                  middle.style.display='none';
                  var next = document.getElementById('next');
                  next.style.display='none';
                  
                  var bottom = document.getElementById('bottom');
                  bottom.style.display='block';
                  var back = document.getElementById('back');
                  back.style.display='block';
              }
              function backPage(){
                  
                  var minCap = document.getElementById('minCap');
                  minCap.style.display='block';
                  
                  var top = document.getElementById('top');
                  top.style.display='block';
                  var middle = document.getElementById('middle');
                  middle.style.display='block';
                  var next = document.getElementById('next');
                  next.style.display='block';
                  
                  var bottom = document.getElementById('bottom');
                  bottom.style.display='none';
                  var back = document.getElementById('back');
                  back.style.display='none';
                  
              }
              function mySubmit(){
                  event.preventDefault();
                  
                  console.log("destop = " + desktop);
                  
                  var fname = document.getElementById('fname').value;
                  var lname = document.getElementById('lname').value;
                  var email = document.getElementById('email').value;
                  
                  var mailformat = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
                  if(!email.match(mailformat)){
                      var em = document.getElementById('email');
                      em.value = "";
                      email="";
                  }
                  
                  if(fname == "" || lname == "" || email == ""){
                      alert("Please enter name and email");
                      if(!desktop)backPage();
                  }else{
                      var myForm = document.getElementById('myForm');
                      console.log(myForm);
                      myForm.submit();
                  }
              }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;form action='getInvolvedCtrl.php' method='POST' id='myForm' novalidate onsubmit="mySubmit()"&gt;
      &lt;span class='majCap'&gt;Get Involved&lt;/span&gt;
      &lt;div id='all'&gt;
          &lt;span id='minCap' class='minCap'&gt;Enter your details below&lt;/span&gt;
          &lt;div id='top'&gt;
              &lt;div class='columns'&gt;
                  &lt;input class='detailsC' type="text"  name="fname" placeholder="First Name" value='Bob' id='fname'&gt;
                  &lt;input class='detailsC' type="text"  name="lname" placeholder="Last Name" value='Cross' id='lname'&gt;
                  &lt;input class='detailsC' type="email" name="email" placeholder="Email..."  value='bc@gml.com' id='email'&gt;
                                 
                  &lt;div class='rowsDet'&gt;
                      &lt;span class='detailsR'&gt;&lt;input  type="checkbox" name="wres"&gt;Weston Resident&lt;/span&gt;
                      &lt;span class='detailsR'&gt;&lt;input  type="checkbox" name="news"&gt;Quarterly Newsletter&lt;/span&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
              &lt;div class='spacer'&gt;&lt;/div&gt;
          &lt;/div&gt;
          &lt;div id='middle'&gt;
              &lt;span class="minCap" &gt;Areas of Interests&lt;/span&gt;
              &lt;div class='rowsInt mobileOnly'&gt;
              &lt;div class="columns"&gt;
                  &lt;span&gt;&lt;input type="checkbox" name="energy-int"&gt;Energy&lt;/span&gt;
                  &lt;span&gt;&lt;input type="checkbox" name="recycling-int"&gt;Recycling&lt;/span&gt;
                  &lt;span&gt;&lt;input type="checkbox" name="composting-int"&gt;Composting&lt;/span&gt;
                  &lt;span&gt;&lt;input type="checkbox" name="transport-int"&gt;Transportation&lt;/span&gt;
              &lt;/div&gt;
              &lt;div class="columns"&gt;
                  &lt;span&gt;&lt;input type="checkbox" name="climate-int"&gt;Climate&lt;/span&gt;
                  &lt;span&gt;&lt;input type="checkbox" name="trees-int"&gt;Trees&lt;/span&gt;
                  &lt;span&gt;&lt;input type="checkbox" name="pollinators-int"&gt;Pollinators&lt;/span&gt;
                  &lt;span&gt;&lt;input type="checkbox" name="water-int"&gt;Water&lt;/span&gt;
                  &lt;span&gt;&lt;input type="checkbox" name="other-int"&gt;Other&lt;/span&gt;
              &lt;/div&gt;
          &lt;/div&gt;
          &lt;div class='desktopOnly rowsInt'&gt;
              &lt;div class="columns"&gt;
                  &lt;span&gt;&lt;input type="checkbox" name="energy-int"&gt;Energy&lt;/span&gt;
                  &lt;span&gt;&lt;input type="checkbox" name="recycling-int"&gt;Recycling&lt;/span&gt;
                  &lt;span&gt;&lt;input type="checkbox" name="composting-int"&gt;Composting&lt;/span&gt;
              &lt;/div&gt;
              &lt;div class="columns"&gt;
                  &lt;span&gt;&lt;input type="checkbox" name="transport-int"&gt;Transportation&lt;/span&gt;
                  &lt;span&gt;&lt;input type="checkbox" name="climate-int"&gt;Climate&lt;/span&gt;
                  &lt;span&gt;&lt;input type="checkbox" name="trees-int"&gt;Trees&lt;/span&gt;
              &lt;/div&gt;
              &lt;div class="columns"&gt;
                  &lt;span&gt;&lt;input type="checkbox" name="pollinators-int"&gt;Pollinators&lt;/span&gt;
                  &lt;span&gt;&lt;input type="checkbox" name="water-int"&gt;Water&lt;/span&gt;
                  &lt;span&gt;&lt;input type="checkbox" name="other-int"&gt;Other&lt;/span&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
      &lt;button id='next' class='mobileOnly' type='button' onclick="nextPage()"&gt;next&lt;/button&gt;
      &lt;div id='bottom'&gt;
          &lt;span class='minCap' &gt;Request Campaign Information:&lt;/span&gt;
          &lt;div class='rowsCam'&gt;
              &lt;div class="columns"&gt;
                  &lt;span&gt;&lt;input type="checkbox" name="cleanup-cpg"&gt;Town Cleanup&lt;/span&gt;
                  &lt;span&gt;&lt;input type="checkbox" name="pollinators-cpg"&gt;Pollinators&lt;/span&gt;
              &lt;/div&gt;
              &lt;div class="columns"&gt;
                  &lt;span&gt;&lt;input type="checkbox" name="gas-cpg"&gt;Gas Leaks&lt;/span&gt;
                  &lt;span&gt;&lt;input type="checkbox" name="cca-cpg"&gt;CCA&lt;/span&gt;
              &lt;/div&gt;
          &lt;/div&gt;
          &lt;div class='spacer2'&gt;&lt;/div&gt;
          &lt;input id='submit' type="submit" value="SUBMIT" name='notSubmit'&gt;
      &lt;/div&gt;
      &lt;button id='back' class='mobileOnly' type='button' onclick="backPage()"&gt;back&lt;/button&gt;
      &lt;/div&gt;
  &lt;/form&gt;</code></pre>
  </div>
  </div>
  </p>