title: How can i display this alert box after checking if my array of checkbox is all not checked
body: <p>Hi guys i am creating a validation for checking if the user has selected at least one stand by checking it, if no stands are selected then an alert box should display telling the user to select at least one stand. my javascript function is triggered onsubmit.</p>
  
  <p>my code is</p>
  
  <blockquote>
  <pre><code>function checkstanddocument(){
  </code></pre>
  </blockquote>
  
  <pre><code> ab = document.getElementById("repo_document_form").elements[['stands[]']];   
    for (var i = 0; i &lt;= ab.length; i++){
  
      if (ab[i].checked == true){
        return true
      }    
   }  
     alert("Please select at least one stand");
     return false
  }
  </code></pre>
  
  <p>I thought the system will only proceed to the alert box if no checkbox is checked, but it doesn't even reach the alert box even if you checked or did not check it, and i want it to display an error if there is no checkbox checked.. can anyone tell me what have i done wrong.please cause it looks 110% correct to me. </p>