1. Hugh is (technically) on vacation for the rest of September, travelling to Europe for his son's wedding in England, and to meet up with Rob in La Rochelle, France. He will be checking the forums most days, and providing some support, but his time will be limited, and he will be unable to do any custom coding work. Apologies in advance for any inconvenience.

Javascript to copy the values into a form

Discussion in 'Professional Support' started by paolo.tateo, Sep 1, 2009.

Thread Status:
Not open for further replies.
  1. paolo.tateo

    paolo.tateo Member

    Level: Community
    My need is this:
    in the table of contacts {suss_contatti} are some fields to define "residence" of people (town, zip code, address, etc ...) and similar fields to define the "domicile" (town, zip code, address, etc. ...).

    Very often, but not always, residence and domicile are the same.

    I would do ensure that people fill out the form can (if you need it) click on a button element, that will copy all the fields in residence in the analogous fields in domicile.

    For example, the button will copy the values in in {suss_contatti___residenzaindirizzo} to {suss_contatti___domicilioindirizzo} and also (note: that this is a joint!) {suss_contatti___residenzacomune} to {suss_contatti___domiciliocomune}

    How can I do this?

    Thanks in advance
  2. peamak

    peamak Moderator

    Level: Community
    You can ad a 'button' element and add a javascript on it:
    on: Click
    Code (Text):
    $('suss_contatti___domicilioindirizzo').value = $('suss_contatti___residenzaindirizzo').getValue();
    Should do it.
    3 people like this.
  3. paolo.tateo

    paolo.tateo Member

    Level: Community
    Thanks peamak!

    This is my JavaScript that work fine !

    $('suss_contatti___domicilioindirizzo').value = $('suss_contatti___residenzaindirizzo').getValue();
    $('suss_contatti___domiciliocivico').value = $('suss_contatti___residenzacivico').getValue();
    $('suss_contatti___domicilioindirizzo2').value = $('suss_contatti___residenzaindirizzo2').getValue();
    $('suss_contatti___domiciliocap').value = $('suss_contatti___residenzacap').getValue();
    $('suss_contatti___domicilioprovincia').value = $('suss_contatti___residenzaprovincia').getValue();
    $('suss_contatti___domiciliocomune').value = $('suss_contatti___residenzacomune').getValue();

    Many thanks
Thread Status:
Not open for further replies.

Share This Page