title: If checkbox selected make input required
body: <p>As part of a web form, I have two checkboxes (both with the name "my_checkbox") and two input filelds (one with the name "input1" and the other named "input2").</p>
  
  <pre><code>&lt;input type="checkbox" name="my_checkbox" value="some text" onclick="a function;    checkBoxValidate(0);"&gt;
  
  &lt;input type="checkbox" name="my_checkbox" value="some diffrent text" onclick="a diffrent function; checkBoxValidate(1);"&gt;
  
  &lt;input id="input1" name="input1"  /&gt;
  
  &lt;input id="input2" name="input2"  /&gt;
  </code></pre>
  
  <p>If user selects the first checkbox, input1 must not be empty. If user selects the second checkbox, input2 must not be empty. The two checkboxes must have the same name. Function checkBoxValidate assures the two checkboxes cannot be selected at the same time (I don't like radio buttons). </p>
  
  <p>My javascript:</p>
  
  <pre><code>}else if (!document.myform.my_checkbox[0].checked &amp;&amp; myform.input1.value == ''){ 
  alert ('Please enter some text!',function(){$(myform.input1).focus();}); 
  return false;
  
  }else if (!document.myform.my_checkbox[1].checked &amp;&amp; myform.input2.value == ''){ 
  alert ('Please enter some text!',function(){$(myform.input2).focus();}); 
  return false;
  </code></pre>
  
  <p>Of course, nothing works! Please help? :)</p>