title: Form validation not working using onsubmit
body: <p>My form validation used to work but now I cannot figure out what is wrong.
  When entering an email or username you always get a pop-up with the error </p>
  
  <blockquote>
    <p>Username or Email is needed</p>
  </blockquote>
  
  <p>Remove each check one by one and you get the next error message</p>
  
  <pre><code>    &lt;form method='POST' name='signIn' onsubmit='return checkLoginForm(this);'&gt;
          &lt;input type='hidden' name='action' value='signIn'&gt;
          &lt;div class='enterInfo' align='left'&gt;Username or Email 1:&lt;/div&gt;&lt;input size='60' type='text' name='username' class='input' id='theFieldID'&gt;&lt;/div&gt;
          &lt;div class='enterInfo' align='left'&gt;Password: &lt;input id='username' size='60' type='password' name='pswd' class='input'&gt;&lt;/div&gt;
          &lt;div class='agreement' align='left'&gt;&amp;nbsp;&lt;/div&gt;
          &lt;input type='submit' value='Log In'&gt;
      &lt;/form&gt;
  </code></pre>
  
  <p>Here is the js</p>
  
  <pre><code>function checkLoginForm(form) {
  
  if(form.username.value == "") {
      alert("Username or Email is needed");
      form.username.focus();
      return false;
  }
  if(form.username.value.length &lt; 4) {
      alert("Username or Email is to short");
      form.username.focus();
      return false;
  }
  re = /^[-_a-zA-Z0-9.,@#!?]*$/;
  if(!re.test(form.username.value)) {
      alert("Username or Email only contains letters, numbers and _-.,@#!?");
      form.username.focus();
      return false;
  }
  
  
  if(form.pswd.value == ""){
      alert("Password is needed");
      form.pwd1.focus();
      return false;
  }   
  return true;
  </code></pre>
  
  <p>}</p>