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:
<script type="text/javascript">
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;
}
}
</script>
<form name="formName">
<input type="text" name="a1">
<br>
<input type="text" name="a2">
<br>
<input type="text" name="a3">
<br>
<input type="checkbox" name="copy" onSelect="copyGroup()"> Copy Group 1
<br>
<input type="text" name="b1">
<br>
<input type="text" name="b2">
<br>
<input type="text" name="b3">
<br>
<input type="submit">
</form>
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.
I think it can be done, but not sure how.
Thanks.