title: multiple checkbox validation javascript
body: <p>I know there are many threads online and I have tried them all but it is still not working, Please help.
  I want to make sure that at least one program is selected. I checked console but there are no errors, also it says debugger not activated.</p>
  
  <p>JavaScript: </p>
  
  <pre><code>function validateForm() {
          if (document.getElementById('cfname').value === '') {
          document.getElementById('errcfname').innerHTML = "Please enter firstname";
          return false;
          }
  
          if (document.enrollment.clname.value == "") {
          document.getElementById('errclname').innerHTML = "Please enter lastname";
          clname.focus();
          return false;
          }
  
          if(validateRadio (document.getElementsByName('gender'))) {
              return true;
          } else {
              document.getElementById('errgender').innerHTML = "Please specify gender";
              return false;
          }
  
          var chk = document.getElementsByName('program[]');
          var len = chk.length;
              var checked = false;
          for(i=0;i&lt;len;i++) {
               if(chk[i].checked) {
                  checked=true;
                              break;
                        }
              }
          if (!checked) {
                  document.getElementById('errpgm').innerHTML = "Please specify program"; 
                  return false;
                } 
          }
          return true;
      }
      function validateRadio(radios) {
          for (i = 0; i &lt; radios.length; ++ i) {
              if (radios[i].checked) 
                  return true;
          }
          return false;
      }
      function validate(id,error) {
          var value = document.getElementById(id).value;
          var err = document.getElementById(error);
          if(!value) {
              err.innerHTML = "*required";
          } else {
              err.innerHTML = "*";
          }
      }
  </code></pre>