developerWorks  >  Lotus  >  Forums & community  >  Notes/Domino 4 and 5 Forum

Notes/Domino 4 and 5 Forum


Copying fields with JS not working
Dan Lebrun 10/31/2007 02:56 PM
Domino Designer -- Forms Release 5 Windows XP

Hi all,
I have a checkbox field called "SameAsBillingAddress" which, once cliked, is supposed to copy the values of some fields to other ones (from billing address fields to shipping adress fields).

When the user clicks on the checkbox in Firefox the following error message comes up saying :

I have received some advice. However, I do not know where to make the required change and I am still getting an error message (in FireFox) as follows:

form.SameAsMailingAddress has no properties
ShipToBillCustomer(form 42e04642140571508425...)42e04642140571508... (line 40)
onchange(change )42e04642140571508... (line 1)
[Break on this error] if (form.SameAsMailingAddress.checked) {

In the onChange event of the checkbox is the following JS code:

I made only one change to the code in the JSHeader event of the form and it’s the first line (new line to define “form”). I would like to make this work but I am not very well versed in JS. Stan, how do I pass both the checked property and the form into the function? How can I get the values copied from one set of fields (billing) to another set (shipping) when clicking on the checkbox field?

//****New line *****
var form = document.forms[0];
var CustomerAddressShip = "";

var CustomerCityShip = "";

var CustomerStateShip = "";

var CustomerCountryShip = "";

var CustomerPostalCodeShip = "";

function InitSaveVariables(form) {

CustomerAddressShip = form.CustomerAddressShip.value;

CustomerCityShip = form. CustomerCityShip.value;

CustomerStateShip = form.CustomerStateShip.value;

CustomerCountryShip = form.CustomerCountryShip.value;

CustomerPostalCodeShip = form.CustomerPostalCodeShip.value;


function ShipToBillCustomer(form) {

if (form.SameAsBillingAddress.checked) {


form.CustomerAddressShip.value = form. CustomerAddress.value;

form.CustomerCityShip.value = form. CustomerCity.value;

form.CustomerStateShip.value = form. CustomerState.value;

form.CustomerCountryShip.value = form. CustomerCountry.value;

form.CustomerPostalCodeShip.value = form. CustomerPostalCode.value;


else {

form.CustomerAddressShip.value = CustomerAddressShip;

form.CustomerCityShip.value = CustomerCityShip;

form.CustomerStateShip.value = CustomerStateShip;

form.CustomerCountryShip.value = CustomerCountryShip;



Go back