There are 2 requirements when you create a form either you redirect to thank you page or show a thank you message after successful submission of the form.
If you are creating Sitecore Forms (previously known as WFFM) then you get an option to redirect to thank you page using one of the Submit action. But if you want to check the validations or show thank you message then it redirects to form builder page (Default behavior).
If you want to learn about how to create a Sitecore Form then you can learn from here.
Assuming you have already created a form(In my case, I have created a Subscribe Form).
The form looks like below in Sitecore Form Dashbaord, with a Save Data submit Action.
Lets try clicking on Subscribe button
You are redirected to Form builder page where the form is validated. To resolve this issue, we need to do 2 changes –
1. In the Sitecore Form, we will add one more page and write a Text may be “Thank you for Subscribing us.” and change the Navigation step to Next.
In the Visual Studio code, you will need to split your layout into layout and Inner layout files. We will apply the Experience Forms scripts and styles on layout & use RenderBody() function to render Inner layout. We will keep the html under body tag inside Inner layout.
Layout File will look like below:
Inner Layout file will look like below:
Publish the code changes and form changes in Sitecore and try to click on Subscribe button again.
And the thank you message will appear once you enter the correct details & submit the form.
In this blog, we learnt how to stop the Sitecore Form from redirecting to the Form builder page and show the validation messages and thank you message on the same page.
Thank you.. Keep Learning.. Keep Sitecoring.. 🙂
2 thoughts on “Avoid Sitecore Form redirecting to forms builder page!”
Unfortunately, this didn’t work for me.
Can you email me (firstname.lastname@example.org) your scenario and layout’s screenshot? I will check if I can help you with it. Also share the outcome of your current implementation.