Jump to:

10931 Posts in 2614 Topics by 1810 members

All other Modules

SilverStripe Forums » All other Modules » Fixed Multi-step form "next" incorrect URL - but always staying on 1st step

Discuss all other Modules here.

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

Page: 1
Go to End
Author Topic: 465 Views
  • KINKCreative
    Community Member
    56 Posts

    Fixed Multi-step form "next" incorrect URL - but always staying on 1st step Link to this post

    FIXED the controller action url by inserting this into the url:

    const URLSegment = 'account'; //whatever you use in the Director rule
       public function getURLSegment() {
          return self::URLSegment;
       public function Link() {
          return self::URLSegment ."/". Controller::getAction();

    But now the form always stays on step one. Using ?StepID=1 or any other number returns an error. Help?

    --- OLD POST ---

    I want to use the Multi-Step form as part of a large(ish) registration process.

    I setup the multiform as follows:


    class CandidateRegistrationForm extends MultiForm {
       public static $start_step = 'CandidateRegistration_Step1';

    /* STEPS */

    class CandidateRegistration_Step1 extends MultiFormStep {
       protected $title = "Information about your new job";
       public static $next_steps = 'CandidateRegistration_Step2';
       function getFields() {
          return new FieldSet(

    class CandidateRegistration_Step2 extends MultiFormStep {
       protected $title = "Experience details";
       public static $next_steps = 'CandidateRegistration_Step3';

    class CandidateRegistration_Step3 extends MultiFormStep {
       protected $title = "Training, languages and executive summary";
       public static $next_steps = 'CandidateRegistration_Step4';

    class CandidateRegistration_Step4 extends MultiFormStep {
       protected $title = "Complete and submit your profile";
       public static $is_final_step = true;

    Since I don't want the page in the SiteTree (I will have multiple sites), so I setup a Director rule in _config.php:

    Director::addRules(100, array(
    'account' => 'AccountController'

    The AccountController.php has the various actions I'd like to access, one of which will call the Multi-step form:

    class AccountController extends Page_Controller {
       public static $allowed_actions = array(
       /* ACTIONS */
       public function init() {
       public function index() {
          return array();
       public function register() {
          return array();
       public function buildprofile() { /* THIS IS THE ONE I'D LIKE TO CALL */
          /* CandidateRegistrationForm::setDisplayLink("account/buildprofile") - tried this */
          return array();
       public function editprofile() {
          return array();
       function CandidateRegistrationForm() {
          $crf = new CandidateRegistrationForm($this, 'CandidateRegistrationForm');
          /* $crf->setDisplayLink("account/buildprofile"); - tried this too */
          return $crf;

    I open mysite/account/buildprofile and the first step displays nicely, but when I click Next... the URL redirects to /AccountController/CandidateRegistrationForm instead of /account/buildprofile/...

    I get lost between controllers, forms and actions so I don't know where to go next, I'd appreciate any help.

    Note: I did try calling the setDisplayLink("account/buildprofile") in the action method and setting it in the form method in the class as you can see above but I'm probably not getting something

    Thank you, guys!

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.