Answered

Pass Token to From first form to Form

  • 27 April 2022
  • 5 replies
  • 261 views

Userlevel 5
Badge +2

Hello,

We are looking for this action. We want to redirect users after completing form, to another form. 

Questions, is it possible to pass unique Typeform Token which was assigned to first form by Typeform and pass it as hidden field to another form? This must happen instantly, user submits the form and redirected to the new form as if it is next step, next questionnaire?  

Given Typeform Stripe/Google Tagmanager can not be used together we want to move payments outside to another form, but we need unique identifier to make sure to match respones. Email, Phone doesnt work as this factor, since clients may submit multiple forms, and thus they must be uniquely identified.

Thanks

icon

Best answer by mathio 28 April 2022, 12:28

View original

5 replies

Userlevel 7
Badge +5

Hello,

you can use Redirect on completion or Redirect through Endings to redirect respondent to another typeform. You can build the URL using hidden fields from your typeform.

Userlevel 5
Badge +2

@mathio 
Thanks for the information, yes, I am aware of that. But is there a way to pass Typeform Token which it creates for a submision, to the next form? As I do not see how to create it in hidden field, it doest create it in the google sheets,  but I do not see any variables which I can pass as token to next form. Can you help? 

Or how could a unique code be generated for every form and passed as hidden field to another form?

Userlevel 7
Badge +5

Sorry, I think you are right, you can not generate a unique code in your typeform. I was a bit confused with what is “Typeform Token”.

However if your form is embedded, there is a responseId available in onSubmit callback of our embed SDK. Maybe you could use that to build your redirect URL and redirect from the callback function instead?

Userlevel 5
Badge +2

Hi @mathio 

If it would be embed, on Submit when redirecting to another form immediately, event.response_id, would provide a response id which can be used as hidden field on the redirection?

<script>
// this function needs to be available on global scope (window)
function submit(event) {
console.log(event.response_id)
}
</script>

 

Userlevel 7
Badge +5

Yes, something like this:

<div data-tf-widget="<id>" data-tf-on-submit="didSubmit"></div>
<script src="//embed.typeform.com/next/embed.js"></script>
<script>
function didSubmit(data) {
window.location.href = "http://example.com?responseId=" + data.responseId
}
</script>

Please use responseId from the payload as response_id is the old name.

Reply