Jump to content

Check Box To Autofill Bill To Address


Recommended Posts

Hello,
 
I have been working on this code all day trying to get it to work in my form.  I have a check box named "BillTo_Same" and when it is checked I want the customer address to auto fill the Bill To address.  I'm not sure why this isn't working...  All my ID's match the system correctly and the code is in the footer of my form.
 
 
Any help would be appreciated.
 
<script>

function f_address()
{
if(document.getElementById('BillTo_Same').checked)
     {
  document.getElementById('InsertRecordBillToName').value=document.getElementById('InsertRecordCompany').value;
document.getElementById('InsertRecordBillToAddress').value=document.getElementById('InsertRecordAddress').value;
document.getElementById('InsertRecordBillToCity').value=document.getElementById('InsertRecordCity').value;
document.getElementById('InsertRecordBillToState').value=document.getElementById('InsertRecordState_Province').value;
document.getElementById('InsertRecordBillToZip').value=document.getElementById('InsertRecordZip_Code').value;
document.getElementById('InsertRecordBillToCountry').value=document.getElementById('InsertRecordCountry').value;
} else {
document.getElementById('InsertRecordBillToName').value="";
document.getElementById('InsertRecordBillToAddress').value="";
document.getElementById('InsertRecordBillToCity').value="";
document.getElementById('InsertRecordBillToState').value="";
document.getElementById('InsertRecordBillToZip').value="";
document.getElementById('InsertRecordBillToCountry').value="";
}


}
document.getElementById('BillTo_Same').onclick= f_address;
</script>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...