Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Jun 2002
    Location
    Edinburgh, UK
    Posts
    402
    Thanks
    2
    Thanked 1 Time in 1 Post

    Verifying and copying data.

    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,
    Rich

    "An expert is a person who has made all the mistakes that can be made in a very narrow field."

  • #2
    Senior Coder
    Join Date
    Aug 2002
    Posts
    3,467
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Maybe something like this
    Code:
    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);"/>
    My Site | fValidate | My Brainbench | MSDN | Gecko | xBrowser DOM | PHP | Ars | PVP
    “Minds are like parachutes. They don't work unless they are open”
    “Maturity is simply knowing when to not be immature”


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •