1. Important notice about Cloudbleed - if your site uses the Cloudflare CDN, and you intend to follow the Joomla security team's advice to change your site "secret", you MUST READ THIS NOTICE.
  2. Fabrik 3.6 Released Remember to backup and test your backup before proceeding with this update. Please report any problems you might experience with this new version here on the forum. You are safe to upgrade to Joomla! 3.7 and PHP 7.x with this version of Fabrik. View the blog for more details on this release.

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: Professional
    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:
    Code (Text):
    $('suss_contatti___domicilioindirizzo').value = $('suss_contatti___residenzaindirizzo').getValue();
    Should do it.
     
    3 people like this.
  3. paolo.tateo

    paolo.tateo Member

    Level: Professional
    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
    Paolo
     
Thread Status:
Not open for further replies.

Share This Page