What is JotForm?
JotForm is a free online form builder which helps you create online forms without writing a single line of code. No sign-up required.

At JotForm, we want to make sure that you’re getting the online form builder help that you need. Our friendly customer support team is available 24/7.

We believe that if one user has a question, there could be more users who may have the same question. This is why many of our support forum threads are public and available to be searched and viewed. If you’d like help immediately, feel free to search for a similar question, or submit your question or concern.


  • Profile Image

    How to Give Users the Ability to Easily Copy Content from One Field to MANY fields

    Asked by aylin77 on August 29, 2012 at 09:11 AM

    Hi,

     

    I followed this tutorial, and it works very well to copy one field to another :

    http://www.jotform.com/help/read.php?if_id=107

     

    But in fact, my form helps me to get several contacts, who may be the same :

    - the CEO

    - the CFO

    - the CIO

     

    But for small companies, all of them can be just one person :-)

     

    So I put 2 checkboxes, one before the CFO fields and one before the CIO field, build 2 functions, called with the onlick :

     

    function copy_ceo_cfo() // the CEO is also CFO

    {

    if(document.form_22354428370956.input_275_0.checked){

    document.form_22354428370956.first_40.value=document.form_22354428370956.first_19.value;

    document.form_22354428370956.last_40.value=document.form_22354428370956.last_19.value;

    document.form_22354428370956.input_38.value=document.form_22354428370956.input_20.value;

    document.form_22354428370956.input_41.value=document.form_22354428370956.input_21.value;

    document.form_22354428370956.iinput_42_area.value=document.form_22354428370956.input_22_area.value;

    document.form_22354428370956.input_42_phone.value=document.form_22354428370956.input_22_phone.value;

    }else{

    document.form_22354428370956.first_40.value="";

    document.form_22354428370956.last_40.value=";

    document.form_22354428370956.input_38.value="";

    document.form_22354428370956.input_41.value="";

    document.form_22354428370956.iinput_42_area.value="";

    document.form_22354428370956.input_42_phone.value="";

    }

    }

     

     

     

     

    function copy_ceo_cio() // the CEO is also CIO

    {

    if(document.form_22354428370956.input_274_0.checked){

    document.form_22354428370956.first_193.value=document.form_22354428370956.first_19.value;

    document.form_22354428370956.last_193.value=document.form_22354428370956.last_19.value;

    document.form_22354428370956.input_194.value=document.form_22354428370956.input_20.value;

    document.form_22354428370956.input_195.value=document.form_22354428370956.input_21.value;

    document.form_22354428370956.input_196_area.value=document.form_22354428370956.input_22_area.value;

    document.form_22354428370956.input_196_phone.value=document.form_22354428370956.input_22_phone.value;

    }else{

    document.form_22354428370956.first_193.value="";

    document.form_22354428370956.last_193.value="";

    document.form_22354428370956.input_194.value="";

    document.form_22354428370956.input_195.value="";

    document.form_22354428370956.input_196_area.value="";

    document.form_22354428370956.input_196_value.value="";

    }

    }

     

    For the two checkboxes concerned, i put respectively these calls :

    onclick="copy_ ceo_cfo ();"

    onclick="copy_ ceo_cio ();"

     

    It doesn't work, probably because the values to copy are the same in both functions (it works fine if I use just one function !).

     

    I know this is not a pure Jotform issue, sorry if it's perceveid tactless...

     

    Thank you !

     

  • Profile Image
    JotForm Support

    Answered by NeilVicente on August 29, 2012 at 10:01 AM

    Please use these codes instead:

    http://pastie.org/4610322

    By the way, your onClick functions must not have spaces.

    onClick="copy_ceo_cfo();"

    onClick="copy_ceo_cio();"


    Kindly contact us again if you're still having issues.