Answered

Redirect with unique URL that identifies the response

  • 11 July 2022
  • 6 replies
  • 634 views

Userlevel 4
Badge +2

Hey,

I have a use-case that I was hoping to get some help with.

We want to redirect the respondent of a form to a page. This page will display a summary/analysis of individual response. (Note that the initial form will be embedded in a form - this is not an issue if we can, for instance, send out unique links to the form in emails.)

The issue is about how to identify the user’s response from the new page.

Our current plan is as follows:

  1. Embed the form on a webpage, and add a JavaScript or some such that adds a dynamic ID to a hidden variable every time the page/form is loaded.
  2. Use the hidden variable as a part of the redirect URL.
  3. Use the hidden variable placed in the redirect URL to get the response from Typeform’s API.

We’re comfortable with (2) and (3), but haven’t yet detailed out (1).

Does anyone know of any other (better?) ways to solving this? The ideal, we think, would have been to have the option to add the response_id field to the redirect URL, but that’s not (yet?) an option.

Regards,

Mikkel

icon

Best answer by Mikkel 14 July 2022, 11:43

View original

6 replies

Userlevel 7
Badge +5

Hi @Mikkel Happy Monday!

@picsoung or @mathio may be able to help you out with this!

Userlevel 7
Badge +5

Hello @Mikkel 

you could do the redirect in “onSubmit” callback of your embedded form, there is a unique response ID passed to this callback function.

Userlevel 4
Badge +2

Thank you, @Liz and @mathio!

If I understand the onSubmit documentation correct, we could create a callback function that, when the form is submitted, will

  1. Obtain - for instance - the response_id from the submitted response, and
  2. Add this response_id to a redirect URL, e.g. to a path like this;
    https://www.showresultspage.test/something/<response_id>
    and, finally,
  3. Redirect the iFrame (or page) to the path in the previous step

Is that correct?

That… sounds pretty much perfect, to be honest.

Userlevel 7
Badge +5

Yes that is correct! You can see the callback in action in one of our demos on CodeSandbox here.

Userlevel 4
Badge +2

That’s great! Thank you for your assistance 😀

Userlevel 7
Badge +5

Happy you found the solution you were looking for, @Mikkel! By the way, make sure to send us the link to your form so we can take a look and give some feedback on it! 😉

Reply