Pass Token to From first form to Form | Community
Skip to main content
Answered

Pass Token to From first form to Form


Forum|alt.badge.img+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

Best answer by mathio-tf

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.

View original

5 replies

mathio-tf
Typeform
Forum|alt.badge.img+5
  • Typeform
  • 888 replies
  • April 27, 2022

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.


Forum|alt.badge.img+2
  • Author
  • Sharing wisdom
  • 57 replies
  • April 28, 2022

@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?


mathio-tf
Typeform
Forum|alt.badge.img+5
  • Typeform
  • 888 replies
  • April 28, 2022

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?


Forum|alt.badge.img+2
  • Author
  • Sharing wisdom
  • 57 replies
  • April 28, 2022

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>

 


mathio-tf
Typeform
Forum|alt.badge.img+5
  • Typeform
  • 888 replies
  • Answer
  • April 28, 2022

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