title: How do I validate a group of textboxes using javascript?
body: <p>I have group of check-boxes and corresponding text-boxes with them.  I can get each checkbox one by one, but how do I get the group of textboxes so I can validate them?</p>
  
  <p>Here is my javascript code below: </p>
  
  <pre><code>function validate_orderform(proform) 
  {           
  var flag=0;
  for (var i = 0; i &lt; proform.chk.length; i++) {
     if (proform.chk[i].checked &amp;&amp; proform.quant[i].value=="") {       
          flag=1;
     }
  }
  
  if(flag==1){
  return false;
  }
  
  return true;
  }
  </code></pre>
  
  <p>and my html code: </p>
  
  <pre><code>&lt;td&gt;&lt;input type="checkbox" id="chk1" name="chk"&gt;&lt;/td&gt;
  &lt;td&gt;&lt;input type="text" size="10" id="quant1" name="quant1"&gt;&lt;/td&gt;...and so on
  </code></pre>