How to pass the values from one field to another using a Substring Widget

  • Shawn_team
    Asked on May 8, 2024 at 3:34 PM

    Is it possible to embed code within the form that will allow me to take the data a client enters into a particular field (short text field in this case) and then populate that unique data later in the form?


    For example, lets say I have a question followed by a short text field:

    What is your name? ________ (short text field)

    When completing the form, they type in the name John


    Now later in the form I want to use the answer they have given in that field:

    Hello John (the short text field data entry). Thank you for taking the time to answer these questions. We look forward to seeing you soon.


  • Jovanne JotForm Support
    Replied on May 8, 2024 at 3:59 PM

    Hi Shawn,

    Thanks for reaching out to Jotform Support. Yes, it is possible to get the value entered on the Short Text field and display it on any part of the form including your Thank You message. Let me show you how:

    • In your Form Builder, add the Short Text fields and other fields necessary for your form.

    How to pass the values from one field to another using a Substring Widget Image 1 Screenshot 60

    • To get the value entered in the Short Text field, go to its Properties then click the Advanced option. Get the Unique Name since that is the variable that will contain whatever is entered on this field.

    How to pass the values from one field to another using a Substring Widget Image 2 Screenshot 71

    • Once done, place the Unique Name of the Paragraph field to show that the value is passed within the page.

    How to pass the values from one field to another using a Substring Widget Image 3 Screenshot 82

    • You can also pass the value in the Thank You page. You just need to go to the Form Settings then click the Thank You page. Place the Unique Name to display it as well.

    How to pass the values from one field to another using a Substring Widget Image 4 Screenshot 93

    Here is the result:

    How to pass the values from one field to another using a Substring Widget Image 5 Screenshot 104

    You can also check my cloned form as a reference.

    Give it a try and let us know how it goes.

  • Shawn_team
    Replied on May 8, 2024 at 11:11 PM

    Thank you very much Jovanne! This was very helpful and worked. Here is a follow up question for you please.


    When using the Full Name field option for entering a name, when I use the unique name {name} for using the data entered in a text field it gives me the full name (first and last name). Is there a way I can get the value for just the first name? Can I get a combination as well (ex. prefix + last name)?


    Thank you.

  • Ruan JotForm Support
    Replied on May 9, 2024 at 2:35 AM

    Hi Shawn,

    Thanks for getting back to us. I'll need a bit of time to look into this. I'll get back to you as soon as I can. 

    Thanks for your patience and understanding while we look into this.

  • Ruan JotForm Support
    Replied on May 9, 2024 at 4:14 AM

    Hi Shawn,

    Thanks for patiently waiting. It is possible to use the Full Name element and only pass a certain field of the element by adding a Substring widget to your form and passing the Field ID from the Full Name element to the Substring Widget. After that, you can use the Unique Name of the Substring widget to use it in your form. Let me walk you through the steps:

    1. In Form Builder, click on Add Form Element at the top-left of your screen.
    2. In the Widgets tab of the left-side Panel, navigate to the Substring Widget and drag and drop it into your form. If you want to use the Prefix, First Name, and Last Name, you'll need to add a Substring Widget for each of them. How to pass the values from one field to another using a Substring Widget Image 1 Screenshot 60
    3. Now, click on the Full Name field and then click on the Gear icon.
    4. In the Advanced tab of the Panel on the right, scroll down to Field Values and then click on the Downward Arrow. How to pass the values from one field to another using a Substring Widget Image 2 Screenshot 71
    5. Next, navigate to the Field IDs field and then copy the Field ID for Prefix.
    6. Now, click on the Substring Widget and then click on the Wand icon.
    7. In the Source Field ID field, paste the Field ID.
    8. Next, in the Substring Start field, enter 0, and in the Substring End field, enter 20. How to pass the values from one field to another using a Substring Widget Image 3 Screenshot 82
    9. Now, click on the Substring Widget and then click on the Gear icon.
    10. In the Advanced tab of the Panel on the right, navigate to Field Details and copy the Unique ID.
    11. Finally, paste the Unique ID in the field you want to use. For this example, I'm using the Paragraph element. How to pass the values from one field to another using a Substring Widget Image 4 Screenshot 93

    That's it. You'll need to follow the same instructions for First Name and Last Name too. Check out the screencast below to see my results:

    How to pass the values from one field to another using a Substring Widget Image 5 Screenshot 104

    I also created a Demo Form that you can check out and clone for further testing.

    Reach out again if you have any more questions.

  • Shawn_team
    Replied on May 9, 2024 at 11:25 AM

    Boom! Got it. Thank you so much for your time Ruan. It worked perfectly.

 
Your Answer