title: Simple form validation help "Cannot read property 'elements' of undefined"
body: <p>newbie here, im trying to figure out  why i get "Cannot read property 'elements' of undefined ".</p>
  
  <p>javascript:</p>
  
  <pre><code>function conf()
  {
      for (i=0; i&lt;5; i++)
      {
          box = document.project.elements[i];
          if (!box.value) 
          {
              alert('You haven\'t filled in ' + box.name + '!');
              return false
          }
      }
      return true;
  }
  </code></pre>
  
  <p>html:</p>
  
  <pre><code>&lt;form id="project" onsubmit="return conf()" action="#"&gt; 
      &lt;fieldset&gt;
          &lt;legend&gt;Contact Details&lt;/legend&gt;
          &lt;label for="txtname"&gt;Your Name:&lt;/label&gt; &lt;input type="text" class="text" name="txtname" id="1" /&gt;&lt;br/&gt;
          &lt;label for="txtemail"&gt;Email:&lt;/label&gt; &lt;input type="text" class="text" name="txtemail" id="2"/&gt;&lt;br/&gt;
          &lt;label for="txtartist"&gt;Artist:&lt;/label&gt; &lt;input type="text" class="text" name="txtartist" id="3"/&gt;&lt;br/&gt;
          &lt;label for="txtalbum"&gt;Song / Album:&lt;/label&gt; &lt;input type="text" class="text" name="txtalbum" id="4"/&gt;&lt;br/&gt;
          &lt;label for="txtcomments"&gt;Comments:&lt;/label&gt; &lt;textarea class="ta" name="txtcomments" id="txtcomments" cols="30" rows="20"&gt;&lt;/textarea&gt;&lt;br/&gt;
          &lt;input type="submit" class="buttons" id="btnSubmit" name="btnsubmit" value="Send Enquiry"/&gt;
      &lt;/fieldset&gt;
  &lt;/form&gt;
  </code></pre>