Sitecore Forms – transfer data between multipage

Sitecore Forms is a great tool to get your visitors to leave information that you can collect and further enhance their experience.

By Danny Paul van Iersel, 12-04-2024

Using conditions based on a previous page choice

Using a form with a multipage setup is a great way to setup a user journey and collect more information. With these steps a user could be asked for their personal information and in the next step more detailed information about what they might actually would like to request from you.

By default it is not possible to have conditions based on a previous page choice.

For example if we have a radio list on the first page and want to have a condition on the second page based on their choice given from that radio list.

For example we have a complaints form. In our radio list we ask the user what the complaint is about. The options will be:

  • Their Account
  • Error on website
  • General questions

In our second page we ask the user to provide additional information and want to enforce showing fields based on what they entered from our first page. If they have chosen account we want to ensure they are filling n their account number. If they have issues with the website we want them to provide a URL of the error. For last if they have a general question we want them to provide a description of their question.

Using conditions based on a previous page choice

By default it is not possible to have conditions based on a previous page choice.

For example if we have a radio list on the first page and want to have a condition on the second page based on their choice given from that radio list.

For example we have a complaints form. In our radio list we ask the user what the complaint is about. The options will be:

  • Their Account
  • Error on website
  • General questions

In our second page we ask the user to provide additional information and want to enforce showing fields based on what they entered from our first page. If they have chosen account we want to ensure they are filling n their account number. If they have issues with the website we want them to provide a URL of the error. For last if they have a general question we want them to provide a description of their question.

 

How to setup our Form

On the page we want to use the other page data, we create a hidden field. As default value we set a value that we can later check if our processor is working correctly. It will be replaced with the actual value but if the default value is shown we know our processor is not functioning as we want:

Setup a pipeline config with the following setting:

We then need to create our Form processor code:

Now what only rests for us to do is to setup the conditions on our page.

When adding a section we can then configure the following condition:

 

Conclusion

This is one way of achieving your goal to use data between multiple pages in a Sitecore form. We have received the questions multiple times and achieved this in our setup. With a small adjustment to your code you are able to create the flows that your require.

Are you having issues with your environment and achieving your goals? Contact us and we are happy to help you out or give our expertise on how you could solve your issues.

Get in Touch

Ready to take your digital experience to the next level? Feel free to contact us to learn more about our services and how we can help you leverage the full potential of your digital marketing.

Tell us about your project

And we'll come up with a tailor-made solution

Get in touch with one of our consultants to find the perfect match that fits your needs and enables you to grow.

Cookie Policy

Our site uses cookies to improve the website experience. By using our website, you agree to our use of cookies. Click here for more information.

Save preferences