View Full Version : state field for copying shipping same as billing not working
12-07-2009, 07:09 PM
I am trying to copy the billing information to be the same as the shipping information when they select the checkbox. Everything seems to work except for the State field which is a drop down. Depending on what country they select, the state field will automatically populate.
Does anyone know how I can copy the billing state to be the same as shipping as well?
Text file attached.
Thanks in advance.
12-07-2009, 08:52 PM
You could do it by sending an event to the country field in the shipping part of the form to cause it to then change the state in shipping, but I think an easier way would be to just disable *both* the country and state fields in shipping and then *ADD* two <input type=text> fields with country and state that match billing.
12-07-2009, 09:04 PM
Looked at your code after answering.
You already have all the code you need to make this easy!
Just add one line.
Let's do it this way:
form.Bill_To_Company.value = form.Ship_To_Company.value;
form.Bill_To_Contact_Name.value = form.Ship_To_Contact_Name.value;
form.Bill_To_Department.value = form.Ship_To_Department.value;
form.Bill_To_Address_1.value = form.Ship_To_Address_1.value;
form.Bill_To_Country.selectedIndex = form.Ship_To_Country.selectedIndex;
form.Bill_To_City.value = form.Ship_To_City.value;
form.Bill_To_State.selectedIndex = form.Ship_To_State.selectedIndex;
form.Bill_To_Zip.value = form.Ship_To_Zip.value;
form.Bill_To_Phone.value = form.Ship_To_Phone.value;
} ... rest same ...
Line in red is added.
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.