Answered

Pass option's value to hidden field

  • 28 October 2023
  • 7 replies
  • 158 views

Userlevel 1
Badge

In my survey, I have set up a hidden field called 'surveyflag'. There is a multi choice in the survey. My question is: Can I set a value for each of the two options, such as Option A = 1, Option B = 2, and then pass the value to the hidden field when the survey is submitted?

icon

Best answer by john.desborough 31 October 2023, 03:46

View original

7 replies

Userlevel 7
Badge +5

Hi @RenataChang Happy Monday! I hope you had a great weekend. 😀

Are you sending the data from the hidden field out of the survey? Or are you trying to have the hidden field value captured with their response in the Typeform results? 

Userlevel 1
Badge

@Liz  Thanks for the response.
It’s the second one, I'm not sure if Typeform can do this right now.

Userlevel 7
Badge +6

@RenataChang - if you are capturing the response in the typeform/question, there is really no need to add it to a hidden field. 

If you are passing the data from an external source (ie CRM/ESP) and you want to pass in, for example, the email of a subscriber, you would do that in the url with the name=value in the url. in the typeform, you would create a hidden variable called the same name as in your url string and it would act as the recipient of the data value. 

on submit, both the answers to questions AND a hidden variable passed into the form are recorded 

 

des

Userlevel 1
Badge

@john.desborough

I forgot to mention that because I have set up a webhook, the API needs to receive the same field name’s result. That's why I set up a hidden field in the survey first and tried to populate the hidden field with the user's response when they submit the survey and send it to the API. I apologize for not explaining clearly earlier and causing confusion.

So the situation isn't about passing values to Typeform from an external source first. The hidden field value I set up must be extracted from the results of this question and sent to the API.

 

Userlevel 7
Badge +6

@RenataChang - the choice the user makes of dvd or book is going to be passed as part of the name/value pair that looks like this: 

  • q1_text = DVD 

it’s already available to the API

if you want to pass it as a variable, you simply need to create a custom variable NOT a hidden variable 

tthen you use the logic rules to replace the value of the variable you create with the output from the question choice 

here’s an example: 

you can create the variable (i used v_example) and used the replace function to set the value of the variable with the hardcoded text line

you would have to do this with every option - ie create a logic rule

 

you don’t need to do this if you can pass the question_text/choice name pair from the submit function 

 

des

Userlevel 1
Badge

@john.desborough Thank you for the support, I will try this out.

Userlevel 7
Badge +5

Let us know how it goes @RenataChang !

Reply