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

Session setFormMessage


Go to End


1414 Views

Avatar
spierala

Community Member, 80 Posts

14 August 2012 at 7:06am

Hello,
I was just building a custom form in SS3 as described here:

http://doc.silverstripe.org/framework/en/topics/forms

works far so fine. Now I´m setting the message which is going to be displayed after submit like that:

Session::setFormMessage($form->FormName(), "Thank You.", "good");

Now the annoying thing is that the message is displayed forever even when the form is reloaded.
How can I make that message disappear after reload?

here the template code:

    <% if Message %>
    <p id="{$FormName}_error" class="message $MessageType">$Message</p>
    <% else %>
    <p id="{$FormName}_error" class="message $MessageType" style="display: none"></p>
    <% end_if %>

Thank you,
Florian