title: Javascript form validation, onblur validation and submitting
body: <p>I am writing a basic form validation script, basically as we go through the form each field is checked onblur like this</p>
  
  <pre><code>            &lt;p&gt;
                  &lt;label&gt;Full Name *&lt;/label&gt;
                  &lt;input type="text" id="fullName" value="" onblur="validate('FullName', 'fullName');" /&gt; 
                  &lt;span class="formHint" id="hintFullName"&gt;Enter your full name&lt;/span&gt;
                  &lt;span id="errorFullName"&gt;&lt;/span&gt;
                  &lt;span class="success" id="successFullName"&gt;&lt;img src="images/tick.png" /&gt;&lt;/span&gt;
              &lt;/p&gt;
  </code></pre>
  
  <p>This all works fine calling the function validate which I made so that you could pass it the field name and it will just check if it has been entered etc. This is all fine. Below is the validate function.</p>
  
  <pre><code>    function validate(field) {
  
  
      // Get the  value of the input field being submitted
      value = document.getElementById(field).value;
  
      // Set the error field tag in the html
      errorField = 'error' + field;
  
      // Set the success field
      successField = 'success' + field;
  
      if (value != '') {
          document.getElementById(successField).style.display = 'block';
          document.getElementById(errorField).style.display = 'none';
      } else {
          document.getElementById(successField).style.display = 'none';
          document.getElementById(errorField).style.display = 'block';
      }
  }
  </code></pre>
  
  <p>Now my question is, after validating on the fly using the onblur what is the best way for me to proceed when submitting? Do I need to write another function to manually check all of the form fields or is there a better way.</p>
  
  <p>I have been thinking about it for a while but I cant seem to think the best way to check once submitted.</p>
  
  <p>Sorry if any of this doesn't make sense, been confusing myself for a few hours now.</p>
  
  <p>Many thanks in advance.</p>