title: onsubmit return validateForm isn't triggering
body: <p>This is really throwing me for a loop.
  I had this form successfully validating with my javascript by calling <code>onsubmit="return validateForm()"</code> when my <code>validateForm</code> function was inside a global variable. Unfortunately, once I started trying to debug IE8, I kept getting errors for having a global variable and I decided to make it a global function instead...</p>
  
  <p>Now I can't seem to get it to trigger at all. -_-</p>
  
  <p>(And yeah—I've actually prefixed it in testing to make sure it wasn't conflicting due to being global.)</p>
  
  <p>From what I can tell, I'm doing the epitome of a basic form. This method is the one shown on w3schools, and it works for them, so... what gives?</p>
  
  <p>My form:</p>
  
  <pre><code>&lt;form name="emailus" id="emailus" action="&lt;?php echo $_SERVER['PHP_SELF']; ?&gt;" method="post" onsubmit="return validateForm()"&gt;
      &lt;a href="mailto:example@email.com"&gt;
          &lt;h3&gt;&lt;i class="icon-envelope-alt icon-large"&gt;&lt;/i&gt;Send us an email&lt;span&gt;: example@email.com&lt;/span&gt;&lt;/h3&gt;
      &lt;/a&gt;
  
      &lt;div class="half"&gt;
          &lt;fieldset class="name"&gt;
              &lt;label for="cf_name"&gt;Name &lt;span&gt;*&lt;/span&gt;&lt;/label&gt;
              &lt;input type="text" id="cf_name" name="cf_name" class="textualformfield" placeholder="Jane Doe" pattern="^[a-zA-Z'\s]+$"&gt;
          &lt;/fieldset&gt;
          &lt;fieldset class="emailaddress"&gt;
              &lt;label for="cf_email"&gt;E-mail &lt;span&gt;*&lt;/span&gt;&lt;/label&gt;
              &lt;input type="text" id="cf_email" name="cf_email" class="textualformfield" placeholder="janedoe@email.com" pattern="[a-z0-9!#$%\x26'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%\x26'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+(?:[A-Z]{2}|com|org|net|edu|gov|mil|biz|info|mobi|name|aero|asia|jobs|museum)\b"&gt;
          &lt;/fieldset&gt;
          &lt;fieldset class="phonenumber"&gt;
              &lt;label for="cf_phonenumber"&gt;Phone&lt;/label&gt;
              &lt;input type="tel" id="cf_phonenumber" name="cf_phonenumber" class="textualformfield" placeholder="555-555-5555"&gt;
          &lt;/fieldset&gt;
          &lt;fieldset class="eventdate"&gt;
              &lt;label for="cf_eventdate"&gt;Event Date&lt;/label&gt;
              &lt;input type="text" id="cf_eventdate" name="cf_eventdate" class="textualformfield" placeholder="May 25th, 2012"&gt;
          &lt;/fieldset&gt;
          &lt;fieldset class="location"&gt;
              &lt;label for="cf_location"&gt;Location&lt;/label&gt;
              &lt;input type="text" id="cf_location" name="cf_location" class="textualformfield" placeholder="The Church"&gt;
          &lt;/fieldset&gt;
      &lt;/div&gt;
  
      &lt;div class="half"&gt;
          &lt;textarea name="cf_message" class="textualformfield" placeholder="Your Message"&gt;&lt;/textarea&gt;
      &lt;/div&gt;
  
      &lt;input type="submit" name="submit" id="submit" value="Submit"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>My javascript function, located outside of <code>(document).ready</code> so that it <em>should</em> be able to be called:</p>
  
  <pre><code>function validateForm() {
      window.alert("I'm activating!");
      var valid = true;
  
      jQuery('p.validationhelpers').remove();
  
      if (document.emailus.cf_email.value === '') {
          jQuery('.emailaddress').append("&lt;p class='validationhelpers'&gt;Please enter an email address.&lt;/p&gt;");
          jQuery('.emailaddress&gt;input').focus();
          valid = false;
      }
  
      if (document.emailus.cf_name.value === '') {
          jQuery('.name').append("&lt;p class='validationhelpers'&gt;Please enter your name.&lt;/p&gt;");
          jQuery('.name&gt;input').focus();
          valid = false;
      }
  
      return valid;
  }
  </code></pre>
  
  <p>Instead, it just submits...
  I feel like this is a dumb problem. I've tried replacing the <code>onsubmit</code>'s content with <code>return validateForm();</code>, <code>return false; return validateForm()</code> (which indeed returned false and prevented submission), <code>return validateForm(); return false();</code>, and <code>validateForm()</code> and <code>validateForm();</code>.</p>
  
  <p>>_&lt;</p>
  
  <p><strong>SOLUTION:</strong> bjornarvh found the real cause from debugging the actual site. I'm highlighting it here because the real answer is <strong>within the comments</strong> of the answer marked as Solved.</p>
  
  <p>Turns out I was missing a closing bracket for one of my functions in javascript, which was causing the <code>validateForm</code> function to be wrapped within <code>(document).ready</code>, which made it inaccessible to <code>onsubmit</code>. Accidental scope issue!</p>