View Full Version : Verifying and copying data.

10-06-2003, 07:21 PM
I have a form on one of my webpages. On this form (Business_form) is two sets of address, one for the contact and one for the company. There is also a checkbox which would ideally mean that the contact details for the contact and company are the same.

If the user ticks the box i want the browser to get the details from the specified fields in the form, display them to the user and then copy them into the company fields.

The contact details i want to have copied are:

pd_address - the address of the contact
pd_tel - the telephone of the contact
pd_fax - the fax of the contact.

These details need to be then copied to the fields:

cd_address - the address of the company
cd_tel - the telephone of the company
cd_fax - the fax of the company

The problem I'm having at the moment is selecting the fields and getting the data out of them. Everything else after that should be plan sailing.

I'd be very grateful for any help.

Many thanks in advance,

10-06-2003, 09:54 PM
Maybe something like this

function setSameInfo( f, reverse )
if ( !reverse )
f.cd_address.value = f.pd_address.value;
f.cd_tel.value = f.pd_tel.value;
f.cd_fax.value = f.pd_fax.value;
} else {
f.cd_address.value = "";
f.cd_tel.value = "";
f.cd_fax.value = "";


<input type="checkbox" onclick="setSameInfo(this.form,this.checked);"/>

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum