This week one of our members came up with an interesting question about the Webform module. They wanted to redirect users to different pages depending on their answers.
Here's how you can make that work using Webform conditionals.
- Install both Webform and the Token module.
- Set up the Webform and the question that you want to rely on for the redirection. In this example, we're using a "Select option" field:
You'll need to make sure that two things are set up correctly here.
- Make sure that you remember your "Field Key":
- Make sure that you have keys set up for each answer:
- Go to the "Form settings" tab.
- Scroll down to "Redirection location" box.
- Click "Browse available tokens".
- You'll see an overview of all the tokens you can use. In this example, we want to use a "Webform submission value".
Here's how the submission value is used. We enter "favorite" to choose the field, and we use "key" to say that want the direction to be based on the answer.
Now when people complete the webform, they will be directed to a new URL, based on their answer: