Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Form Confirmation - redirect to another page

Our old forums are still available as a read-only archive.

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

Page: 1
Go to End
Author Topic: 1785 Views
  • Decisive Flow
    Avatar
    Community Member
    73 Posts

    Form Confirmation - redirect to another page Link to this post

    I need to redirect people who submit a form to another website. How do I do that? Currently It looks like there is only one option which is to manually enter some text. I NEED it to redirect otherwise it will be messy.

    THANKS!

  • simon_w
    Avatar
    Forum Moderator
    471 Posts

    Re: Form Confirmation - redirect to another page Link to this post

    A hackish way:

    Subclass UserDefinedForm and UserDefinedForm_Controller.

    In SubClass_Controller, basically c+p the process method from UserDefinedForm_Controller, except replace:

    $custom = $this->customise(array(
    "Content" => $this->customise( array( 'Link' => $data['Referrer'] ) )->renderWith('ReceivedFormSubmission'),
    "Form" => " ",
    ));

    return $custom->renderWith('Page');

    With

    Director::redirect('URL');

    I think that will work. (:

  • Decisive Flow
    Avatar
    Community Member
    73 Posts

    Re: Form Confirmation - redirect to another page Link to this post

    Thanks for your help... But... I'm not very techie and I need to know where to put that code as well.. which file?

    Thanks again!

  • simon_w
    Avatar
    Forum Moderator
    471 Posts

    Re: Form Confirmation - redirect to another page Link to this post

    I just made a page type with a customisable redirect URL.

    Just extract, and upload RedirectForm.php to mysite/code/ then run db/build?flush=1

    And since attaching didn't seem to work: http://simon.geek.nz/code/RedirectForm.tar.gz

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