Dynamic thank you page, depending on field value

When creating an Umbraco form you set the base workflow to either display a message, or go to a page. I want to be able to redirect the user to a specific page based on something they’ve entered on the form.

For example, if I have a form with a drop down “Where did you hear about us?”, and the user selected “Google” then I want to send the user to “/google”, but if they select “Bing” then they should end up on “/bing”.

My first thought was that you could set conditions on the workflow, but that’s not an option. Guessing this is because it’s a fixed workflow on every form that has to run.

I’ve also found a setting redirectToPageId (as detailed in the docs) but this is dynamic based on where the form is rendered, rather than what the user completes on the form.

Can anyone shed any insight on how this might be acheived please?

Hi Richard :waving_hand:

The docs mention an additionalData parameter as well (alongside the redirectToPageId) - if you could get access to that on the redirected page, you might be able to suss it out, as it’s being processed for Magic strings, which means you could send along the info :thinking:

/Chriztian

1 Like

There is a value on the HttpContext.Items you can modify in a custom workflow to provide a custom redirect Richard. It’s documented here, and could be you can use that for your use case.

Andy

3 Likes

That was way easier than I thought it was going to be; thanks very much for the pointers both :slight_smile:

I went with Andy’s suggestion and created a custom workflow, which when mixed with conditionals gives exactly what I needed.

And if anyone else finds this looking for a solution; please see this gist

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.