munomono
munomono

Reputation: 1245

Redirection after Form Submission

In Silverstripe < 3 you can do smth like this in a form action

Director::redirect(Director::baseURL(). $this->URLSegment . "/?success=1");

and then in Template you can check with <% if Success %> if the Form is submitted.

in >3.1 you'll get

Fatal error: Call to undefined method Director::redirect()

somehow one shold use SS_HTTPRequest but i do not get it how to use this guy.

I want to show a simple success message after form submission.

Upvotes: 2

Views: 2281

Answers (1)

colymba
colymba

Reputation: 2644

Assuming you are handling the form submission in a Controller to redirect you could use

$this->redirect( Director::baseURL() . $this->URLSegment . "/?success=1" );

Upvotes: 3

Related Questions