Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Form Questions /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

How to display a messge after form submission


Go to End


5 Posts   4911 Views

Avatar
mango

Community Member, 26 Posts

5 May 2009 at 5:36pm

I've followed tutorial 3 to build my form successfully, now how do I get it to display a thank you message after the form has been submitted?

Avatar
Nivanka

Community Member, 400 Posts

8 May 2009 at 3:28am

Create a new page called Thank you, and after performing the jobs you wish to do with the form use the Director to redirect the user to the thank you page you created.

Director::redirect("");

Avatar
mango

Community Member, 26 Posts

8 May 2009 at 5:31pm

Is there a way to get back to the original form page but this time with the added 'Thank You' message at the top of that page?

Avatar
Nivanka

Community Member, 400 Posts

8 May 2009 at 7:09pm

you can direct the user to the same page with the following


Director::redirectback();

and to add a custom message to the form just do this in you form processing page,


$form->addErrorMessage("Blurb", 'Page Saved Successfully', "good");

Avatar
mango

Community Member, 26 Posts

8 May 2009 at 9:31pm

Thanks for that, it all works well!!