Jump to content
  • 0

Copy Fields With Conditionals


esisov

Question

Hi,

 

I have a multi step form that is working for request. One of the forms ask to the persons if are single or married. If the person is married, ask the correspondant information (name, email, phone,...) about the husband/wife.

 

On the next step, the form ask to the persons if want an aditional card for the husban/wife. If the persona said yes, i want that the form make a copy/paste of  all the information related to the husband/wife on those fields. I don't want that the persons need to re enter all this information.

 

Thanks!

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

Hi Esisov!

 

On your second form you can create two sections. First will be Yes/No field and the second one will contain Text Fields about the husband/wife, and hidden virtual field that will receive parameters of all fields related to husband's/wife's information. You can hide the second section with rules, and if a User selects "Yes"  a second section will appear and will the help of the script below values from virtual fields will be passed to Text Fields about husband/wife. 

 

Please use the script below : 

<SCRIPT LANGUAGE="JavaScript">

function MyFunction()

    {
            if (document.getElementById('InsertRecordYour_Yes_No_Field').checked)
              {
           document.getElementById('InsertRecordYOUR_FIELD').value=document.getElementById("cbParamVirtual1").value
           document.getElementById('InsertRecordYOUR_FIELD2').value=document.getElementById("cbParamVirtual2").value 
          document.getElementById('InsertRecordYOUR_FIELD3').value=document.getElementById("cbParamVirtual3").value 

         }
     }


document.getElementById('caspioform').onchange=MyFunction;


</SCRIPT>

Please replace YOUR_FIELD  with names of your fields. 

 

 

I hope this helps. 

 

Aurora

Link to comment
Share on other sites

  • 0

Hi, Thank you!

 

I did it, but it is not working, how can i related the condition of the checkbox field with the function?

 

The parameters are passing ok, i just can not insert the records.

 

if (document.getElementById('InsertRecordYour_Yes_No_[@Virtual2]').checked)

 

 

Link to comment
Share on other sites

  • 0

I am using this code.

 

some could give me a hand?, it is not working

 

 

 

<SCRIPT LANGUAGE="JavaScript">
 
function MyFunction()
 
    {
            if (document.getElementById([@Tarjetas_adicionales]).checked== True)
              {
           document.getElementById('InsertRecord[@Primer_nombre_TA_1]').value=document.getElementById("@cbParamVirtual7").value
           document.getElementById('InsertRecord[@Primer_apellido_TA_1]').value=document.getElementById(@cbParamVirtual6).value 
           document.getElementById('InsertRecord[@tipoid_td1]').value=document.getElementById("@cbParamVirtual4").value 
           document.getElementById('InsertRecord[@Identificacion_TA_1]').value=document.getElementById("cbParamVirtual6").value 
           document.getElementById('InsertRecord[@Pais_TD1]').value=document.getElementById("@cbParamVirtual8").value  
           document.getElementById('InsertRecord[@Nacionalidad_TA_1]').value=document.getElementById("@cbParamVirtual9").value 
           document.getElementById('InsertRecord[@Fecha_nacimiento_TA_1]').value=document.getElementById("cbParamVirtual5").value 
           document.getElementById('InsertRecord[@Email_TA_1]').value=document.getElementById("cbParamVirtual10").value 
 
 
         }
     }
 
 
document.getElementById('caspioform').onchange= MyFunction;
 
 
</SCRIPT>
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...