cmaclennan
06-05-2009, 05:46 PM
Hi Guys, hoping someone can help i've been looking around trying to gain some insight into how i can achieve what i want to do as javascript is not my forte.
Essentially I have a form that has customer info and shipping info and if the shipping info is the same as the customer I would like to have a checkbox to automatically fill in the fields with the values from the customer portion.
In my searching I found a script that will do this with 1 field but cant seem to and dont know how to make it work with multiple fields. Any help is greatly appreciated.
Thanks in advance
Code I found for 1 field
Field1: <input type="text" id="field1" value="Hello World!">
<br />
Field2: <input type="text" id="field2">
<br /><br />
Click the button below to copy the content of Field1 to Field2.
<br />
<button onClick="document.getElementById('field2').value=
document.getElementById('field1').value">Copy Text</button>
Essentially I have a form that has customer info and shipping info and if the shipping info is the same as the customer I would like to have a checkbox to automatically fill in the fields with the values from the customer portion.
In my searching I found a script that will do this with 1 field but cant seem to and dont know how to make it work with multiple fields. Any help is greatly appreciated.
Thanks in advance
Code I found for 1 field
Field1: <input type="text" id="field1" value="Hello World!">
<br />
Field2: <input type="text" id="field2">
<br /><br />
Click the button below to copy the content of Field1 to Field2.
<br />
<button onClick="document.getElementById('field2').value=
document.getElementById('field1').value">Copy Text</button>