title: Require 8 digits for input field using Javascript
body: <p>I've created what I think is a simple validation script that requires </p>
  
  <p>1) The registration field be required and</p>
  
  <p>2) The registration field must be 8 digits in length</p>
  
  <p>However, it's not working. I've excluded the other required fields so they don't get in the way. Can someone tell me if I'm completey out of the ballpark?</p>
  
  <p>JAVASCRIPT</p>
  
  <pre><code>&lt;script type="text/javascript"&gt; 
  function validateForm(f)
  {
  
  // Require Registration
   if (f.registration.value == '' &amp;&amp; f.registration.length != 8)
   {
    alert('Please enter your 8-digit registration number.')
    f.registration.focus()
    return false;
   } 
  
  }
  &lt;/script&gt; 
  </code></pre>
  
  <p>HTML</p>
  
  <pre><code>&lt;input type="text" id="registration" name="registration" /&gt;
  </code></pre>