title: Javascript form validation - multiple form fields larger than 0
body: <pre><code>function negativeValues(){
      var myTextField = document.getElementById('digit');
  
      if(myTextField.value &lt; 0)
  {
    alert("Unable to submit as one field has a negative value");
    return false;
    }
  }
  </code></pre>
  
  <p>Above is a Javascript piece of code where every time a field id 'digit' has a value that's less than 0, than an alert box appears either onsubmit or onclick in the submit button.</p>
  
  <p>There are about 50 fields in the form that should be considered 'digit' fields where they shouldn't be anything less than 0. What should I change with this Javascript to ensure that all 'digit' like fields have this alert box pop up?</p>
  
  <p>I cannot use jquery/mootools for validation - it has to be flat Javascript.</p>
  
  <p>Thanks.</p>