I have a Sitecore Form which consists of the following fields:

  • Form Body (Page element) contains: Email and Submit Button
  • Success Page (Page element)
  • Error Page (Page element)

On the click of Submit Button, a custom Submit Action will be called and it will perform some logic. For the moment I am able to call the Success Page by using the Navigation Step as Next, but I in case of failure Error Page should be called. How can I achieve this functionality in the Sitecore Forms?

Thanks for the help.

1 Answer 1


I don't think it's possible without custom code - I see 2 options in that case:

  1. Create a custom field that can verify your result and display the correct information on your page (in this case the success page and error page will merge into one page)
  2. Based upon the ShowFormPage from the Sitecore Forms Extensions (https://github.com/bartverdonck/Sitecore-Forms-Extensions/tree/master/src/Feature/FormsExtensions/code/SubmitActions/ShowFormPage) you could change your submit action to do something almost identical. The action from the extensions can takes one formPageId - if you extend this to enable it to take 2 of those id's (one for error and one for submit) you will have exactly what you need. This solution sets the correct page id in context, and uses the form render pipeline <forms.renderForm> to set the correct parameters in the NavigationData part of the formRenderingContext.

In case of the (preferred) 2nd solution:

  • Install the Sitecore Forms Extensions module first (grab it from the marketplace)
  • Change your code towards the ShowFormPage as mentioned above (you'll need 2 id's in the context though)
  • Configure everything in Sitecore: you'll need you own version of the editor for the field (check /sitecore/client/Applications/FormsBuilder/Components/Layouts/Actions/ShowFormPage to see how it is done in the module) and link that to your submit action (check /sitecore/system/Settings/Forms/Submit Actions/Show Form Page from the module as example)
  • I did not get the first point about the custom field. In Execute function, I am calling an API, if that API returns success/error, how can I show the fields or return some data back to form to show to the end-user in the form on the basis of the response?
    – PSS
    Jul 23, 2019 at 10:05
  • In that case, you would need to store the success in context. Create an extra custom field that displays what is needed based upon that context. I think solution 2 might be better though.
    – Gatogordo
    Jul 23, 2019 at 10:07
  • I tried the second solution, replicate the codebase from the link mentioned above but the Excute method is not being called while clicking on the Submit button. Its just exiting after this function ShowFormPageAction. Is there any way to grab which Page value will be called after returning true?
    – PSS
    Jul 23, 2019 at 10:15
  • Added more info in the answer..
    – Gatogordo
    Jul 23, 2019 at 11:26
  • Thanks for the information. I have another query, API is returning an URL and I want that URL to be visible after clicking the submit button in both the Success/Error pages. Is there any way to achieve this?
    – PSS
    Jul 25, 2019 at 8:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.