MVC and request handling · Question 5 of 12
What is needed to show a success message after saving a form in Extbase?
2 answers are correct. Easy
Show answer
Answer
- A Outputting the ViewHelper <f:flashMessages /> in the Fluid template
- B Adding the message in the controller with $this->addFlashMessage()
Explanation
Flash messages are one-time notices that also survive a redirect. In the controller you add them, for example, with $this->addFlashMessage('Conference saved.', 'Success', ContextualFeedbackSeverity::OK) and then usually redirect with redirect('list'). By default they are stored in the session, which is why they appear on the target page after the redirect. They are rendered in the template with <f:flashMessages /> – without this ViewHelper the visitor never sees the message. An echo in the action does not work, because Extbase produces output exclusively through the returned response object.