Miva Merchant 4 Module FAQs » Phone Order Manager (BROK_PHONEORDERS)


Adding a button to copy Shipping info to Billing info

How can I have a button which will let me copy the shipping information over to the billing information side?

Although the data will be copied over if you click "update" sometimes it is definitely convenient to have a button that does it immediately. This can be accomplished by adding some javascript to the "Main page template" on the "Main Page" tab.

Right under the %beginform% token add the code:

<script language="JavaScript">
function CopyBilltoShipto()
document.PhoneOrdersMain.BillFirstName.value = document.PhoneOrdersMain.ShipFirstName.value;
document.PhoneOrdersMain.BillLastName.value = document.PhoneOrdersMain.ShipLastName.value;
document.PhoneOrdersMain.BillEmail.value = document.PhoneOrdersMain.ShipEmail.value;
document.PhoneOrdersMain.BillPhone.value = document.PhoneOrdersMain.ShipPhone.value;
document.PhoneOrdersMain.BillFax.value = document.PhoneOrdersMain.ShipFax.value;
document.PhoneOrdersMain.BillCompany.value = document.PhoneOrdersMain.ShipCompany.value;
document.PhoneOrdersMain.BillAddress.value = document.PhoneOrdersMain.ShipAddress.value;
document.PhoneOrdersMain.BillCity.value = document.PhoneOrdersMain.ShipCity.value;
document.PhoneOrdersMain.BillStateSelect.value = document.PhoneOrdersMain.ShipStateSelect.value;
document.PhoneOrdersMain.BillState.value = document.PhoneOrdersMain.ShipState.value;
document.PhoneOrdersMain.BillZip.value = document.PhoneOrdersMain.ShipZip.value;
document.PhoneOrdersMain.BillCountry.value = document.PhoneOrdersMain.ShipCountry.value;

then where you want the button to display add html that will run the function when the button is clicked:

<input type="button" value="Copy Shipping to Billing" ONCLICK="JavaScript:CopyBilltoShipto();">

Categories for this entry

Last update: 2009-10-21 23:37
Author: Michael Brock
Revision: 1.0

Print this record Send FAQ to a friend Show this as PDF file
Please rate this FAQ:

Average rating: 0 out of 5 (0 Votes )

completely useless 1 2 3 4 5 most valuable

You cannot comment on this entry

Records in this category