5

While implementing a custom Sitecore 9 Form (not WFFM forms), I need to show success message.

E.g. When I have filled all the data and clicked submit action button, I want to show success message from this page and clear all the fields.

Is it possible?

1 Answer 1

11

You can relatively easily achieve this.

On the form editor navigate to Form Elements panel and find Structure accordion. There you have “Page” element. Drag-and-drop 2 pages to your form. So the first page is going to be your form with submit button, and the second one will display our thank you message.

Sitecore 9 Forms - Thank You Message 01

Sitecore 9 Forms - Thank You Message 02

Add submit button to the first page and don’t forget to specify submit actions (don’t add a redirect in submit actions). Select "Next" for the Navigation step field.

Add “Text” component to the second page and write a thank you message.

Navigate to the Settings tab and set “AJAX enabled” checkbox. Save the form.

Now when you click on the submit button, you’ll see thank you message.

Please don’t forget that you need to have Sitecore 9 Forms scripts and styles loaded on your page.

You can do it with:

@Html.RenderFormStyles() //inside head tag
@Html.RenderFormScripts() //before closing body tag.

Idea and code taken from: http://www.apiqu.com/blog/2018/August/sitecore-9-forms-thank-you-message

3
  • Is it possible to show success message in same page (not move to next page(thank you page). currently i'm using sitecore form with submit action button. while submit the button, i want to show the success message for above or below submit button. Is there any option to show this message
    – PKH
    Jan 22, 2019 at 15:00
  • AJAX enabled is set by default. This solution does not work for me. Jul 9, 2019 at 22:13
  • This technique has one drawback. Submissions of such form will appear as abandoned in form's performance report in Sitecore.
    – whuu
    Feb 9, 2021 at 9:34

Your Answer

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

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