Jump to:

23003 Posts in 11856 Topics by 2828 members

General Questions

SilverStripe Forums » General Questions » [SOLVED] Doesn´t work Director::redirect() is SS3?

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Page: 1
Go to End
Author Topic: 266 Views
  • Bereusei
    Avatar
    Community Member
    94 Posts

    [SOLVED] Doesn´t work Director::redirect() is SS3? Link to this post

    Hey guys,

    I have a simple Form, which sends e-mails. If the formaction is done, the previous page must be loaded.
    In SS 2.4 I have used this:

    function doSubmitEntry($data, $form){
    ...
    $email = new Email($from,$to,$subject,$body);      
    $email->send();
             
    Director::redirect($this->Link("?success=1"));
    return;
    }


    The system sends the e-mails correctly. But the previous page isn´t loaded and the user stays on www.mysite.com/mypage/Form.

    I couldn´t find the right syntax for SS3. Can anyone help?

  • kinglozzer
    Avatar
    Community Member
    138 Posts

    Re: [SOLVED] Doesn´t work Director::redirect() is SS3? Link to this post

    Director::redirect() doesn't exist any more, the redirect() method was moved to the controller class. As you're already in a controller, your code can just use:

    return $this->redirect($this->Link("?success=1"));

  • Bereusei
    Avatar
    Community Member
    94 Posts

    Re: [SOLVED] Doesn´t work Director::redirect() is SS3? Link to this post

    Ahh, great. Thanks!

    266 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.