Passing input values inside the Header or Text field?

  • garyyello
    Asked on April 13, 2015 at 5:49 AM

    Hello, 

    I have a form that has lots of text and heading, in parts of the text I would like to display a code and year, I aim to add these values to the form using a query string and hidden input. 

    My Question is : how can i add the variables to my text inputs for example i have the following heading:

     

    Holidaymaker

    (you see what im trying to achieve?)

     

    thanks.

    Jotform Thread 551140 Screenshot
  • David JotForm Support
    Replied on April 13, 2015 at 11:39 AM

    Hi,

    If you are trying to update field values based on the values entered into other fields, you can use conditional logic:

    http://www.jotform.com/help/286-How-to-Populate-Field-with-a-Value-from-another-Field

    This will allow you to pass the data from one field to another.  When doing this, selecting the option to "insert field as text" will allow for the data to be passed directly as a string.

    If you are trying to place a variable in your form that is updated from an outside source, this unfortunately is not possible at this time.

    If I have misunderstood your question, please clarify a bit more what you are trying to achieve and we will be happy to have another look.

     

  • garyyello
    Replied on April 14, 2015 at 4:52 AM

    Hi Thanks for your replay, 

    I cannot see that this will allow me to change the value of a heading or text as they do not appear in the drop down boxes on the conditions interface.

    Does the tinymce texteditors except some kind of tag syntax? something like {year} ?

     

    Thanks.

  • garyyello
    Replied on April 14, 2015 at 4:54 AM

    Hi, i just found this, 

    http://www.jotform.com/answers/463299-Add-a-line-break-to-the-conditionally-populated-value

    so the answer to my question is no?

     

    thanks.

  • Charlie
    Replied on April 14, 2015 at 10:55 AM

    Hi,

    I believe it won't work on the Headers BUT it will on the "Text" field.

    Here's a sample form I made: http://form.jotformpro.com/form/51033825061950?.

    In my form, the selected option in the dropdown will be passed to the "Text" field which is a text box, I will then get the field name of it and add to my "Text" field. Below is a guide on how I did it:

    1. I added a text box (which will be the temporary storage variable), add a drop down field which will act as the source of the selected data, add the "Text" field which will act as the header like part of the form.

    Passing input values inside the Header or Text field? Image 1 Screenshot 60

    2. Get the field name tag of the text box by checking its properties and add it in our "Text" field.

    Passing input values inside the Header or Text field? Image 2 Screenshot 71

    3. Inside the Properties, copy the name of the field, in this case it's the {text} tag.

    Passing input values inside the Header or Text field? Image 3 Screenshot 82

    4. I will then use a condition to where I will pass the dropdown value to the text box.

    Passing input values inside the Header or Text field? Image 4 Screenshot 93

    5.

    Passing input values inside the Header or Text field? Image 5 Screenshot 104

     

    So basically, using the "Text" field, you can use conditions and pass the value of an input field using the name tags.

    I hope this helps.

    Kind regards.

  • garyyello
    Replied on April 14, 2015 at 11:14 AM

    Thanks for your reply, i actually came up with a better solution of re writing the tags using php.

    I tried your soluting but must have done something wrong, in your form {text} is replaced as a span in my form {text} stays as text.  

    Please see the two screen shots.

    Passing input values inside the Header or Text field? Image 1 Screenshot 30

    Passing input values inside the Header or Text field? Image 2 Screenshot 41

  • Charlie
    Replied on April 15, 2015 at 1:37 PM

    Hi,

    Sorry for the delay in response.

    I believe you need to add the field name tag inside the HTML editor. 

    1. Click the HTML icon in the "Text" field.

    Passing input values inside the Header or Text field? Image 1 Screenshot 30

    2. Make sure that you are adding the name tag inside here. 

    Passing input values inside the Header or Text field? Image 2 Screenshot 41

     

    I hope that helps.

    Kind regards.

  • David
    Replied on October 25, 2015 at 6:13 AM

    Hi Carlie,

    I have successfully used your proposed method to use 'variables' in a html text field. It works  perfectly fine. However, once I add a second language and translate the html text field, the 'variables' display as {variable} in the final form and the desired value doesn't appear, although I edited the translation in the html source code.

    Is there anything I haven't considered?

    Thanks for your quick reply.

    Best,

    David

  • BJoanna
    Replied on October 26, 2015 at 4:52 PM

    @David 

    I have moved you question to separate thread and we will provide you an answer there shortly.

    http://www.jotform.com/answers/690417