title: copy form field values
body: <p>I need to write a code that will copy one set of form values into another. And normally it is done by something like this:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  function copyGroup() {
      if(document.formName.copy[0].checked){
          document.formName.a1.value = document.formName.b1.value;
          document.formName.a2.value = document.formName.b2.value;
          document.formName.a3.value = document.formName.b3.value;
      }
  }
  &lt;/script&gt;
  
  &lt;form name="formName"&gt;
      &lt;input type="text" name="a1"&gt;
      &lt;br&gt;
      &lt;input type="text" name="a2"&gt;
      &lt;br&gt;
      &lt;input type="text" name="a3"&gt;
      &lt;br&gt;
      &lt;input type="checkbox" name="copy" onSelect="copyGroup()"&gt; Copy Group 1
      &lt;br&gt;
      &lt;input type="text" name="b1"&gt;
      &lt;br&gt;
      &lt;input type="text" name="b2"&gt;
      &lt;br&gt;
      &lt;input type="text" name="b3"&gt;
      &lt;br&gt;
      &lt;input type="submit"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>However, I'd like to modify it in such a way that if the checkbox is selected and the the user went back and modified any values in group 1 -- the corresponding fields in group 2 are updated as well. </p>
  
  <p>I think it can be done, but not sure how.</p>
  
  <p>Thanks.</p>