Jump to:

23486 Posts in 18995 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » (solved) Redirect to child page after form submit?

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: 1334 Views
  • prawnstar
    Avatar
    Community Member
    116 Posts

    (solved) Redirect to child page after form submit? Link to this post

    Once I process my form submission I'd like to redirect to a child page of the form.

    I'm sure I'm just missing something simple here.

    I'm trying this (and many variations of):

    function doSignup($data, $form) {
       $submission = new LandingFormSubmission();
       $form->saveInto($submission);
       $submission->write();
       Director::redirect($this->Children()->First()->Link());
    }

    EDIT:
    This isn't the first time this has happened to me. Shame on me. I forgot that this page was "Not shown in menu" so Children() was empty.
    The director should have been:
    Director::redirect($this->AllChildren()->First()->Link());

    Note to anyone else looking at this. If your page is not shown in the menu(Behavior tab), then you have to use AllChildren(), not Children().

    Chris.b

  • Blackthorn87
    Avatar
    Community Member
    27 Posts

    Re: (solved) Redirect to child page after form submit? Link to this post

    Hey there,

    I know this post is quite old, but I was wandering if you could tell me where to insert the code you have mentioned in the post. I have a client who wants a solution similar to what your post talks about.

    They want to create a series of forms that when you submit the first one, the information contained is submitted as normal, but then the page is redirected to the next form in the sequence, and so on til the last form. They also want to be able to adjust which is the next form in the sequence using the CMS.

    Any help would be much appreciated,

    Thanks,

    Arun.

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