Jump to:

5554 Posts in 1742 Topics by 1227 members

Customising the CMS

SilverStripe Forums » Customising the CMS » sessionMessage without Form

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

Page: 1
Go to End
Author Topic: 1964 Views
  • dirkr
    Avatar
    Community Member
    2 Posts

    sessionMessage without Form Link to this post

    Hi,

    is there a way to send a sessionMessage without a form.
    It is supposed to be a response to an action.

    Thanks,
    Dirkr

  • PGiessler
    Avatar
    Community Member
    47 Posts

    Re: sessionMessage without Form Link to this post

    Hi,

    you can check this with PHP, if you have access to this method without create the object form.If this doesn't work, you can create a Javascript or you create a simple PHP method to send a response like sessionMessage.

    Best regards,

    Pascal

  • dirkr
    Avatar
    Community Member
    2 Posts

    Re: sessionMessage without Form Link to this post

    Thanks for your response,

    I was hoping there was something already built in ;-)
    Sth like the flash technique in Rails, where a message could be saved in the session and would be shown on the next page.

    Have fun,
    Dirkr

  • cobianzo
    Avatar
    Community Member
    8 Posts

    Re: sessionMessage without Form Link to this post

    I don't know if there's a way already set in SS to do it, but alternatively you can set the variable session in PHP.

    $FormInfo = array("NameOfTheFormOrWhatever" => array("formError" => array( "message" => "your message", "type" => "good")) );

    Session::set("FormInfo", array_merge( Session::get("FormInfo"), $FormInfo ) );

    The array_merge thing is just to not overwrite other form variables in case there were.

    I guess you probably new this. But just in case I post it.

    1964 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.