Javascript - return false error
<p>I have a form validation function that loops through the form elements checking for empty fields - code below:</p>

<pre><code>function formValidate(ourform){
  var formelems = document.getElementById(ourform).elements;

  for (var i=0; i&lt;formelems.length; i++){
  if(formelems[i].value == "") {
   alert("Empty Field(s). Please fill in all the fields.");
   return false;
    }   
  }    
}
</code></pre>

<p>the problem is that my form does not return false if there's an empty field - it processes the form. I have solved this before but now i just cannot remember how.</p>

<p>Thanks.</p>
