Jump to:

2011 Posts in 1436 Topics by 620 members

Form Questions

SilverStripe Forums » Form Questions » Multistep Form Not Progressing (tutorial out of date)?

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

Page: 1
Go to End
Author Topic: 422 Views
  • Bimble
    Avatar
    Community Member
    16 Posts

    Multistep Form Not Progressing (tutorial out of date)? Link to this post

    I can't get the tutorial listed in the Multistep Form module to work http://addons.silverstripe.org/add-ons/silverstripe/multiform
    A couple of problems are simple enough to debug (replacing some private to public and changing FieldSet to FieldList).

    However, I'm now stuck. When you click on "next", I get "page not found" with no errors in the httpd error logs.

    I posted this same problem before on my code in another forum with no replies. So I thought if I posted on the tutorial code then at least the example code could be updated if a solution is found for 3.x

    class BSCMultiForm_Controller extends Page_Controller {
    private static $allowed_actions = array('index');
    public function index() {
    $this->Content = $this->BCSMultiForm();
    return $this->render();
    }
    }

    class BCSMultiForm extends MultiForm {
    public static $start_step = 'BCSPersonalDetailsFormStep';
    public function finish($data, $form) {
    parent::finish($data, $form);
    $steps = DataObject::get(
    'MultiFormStep',
    "SessionID = {$this->session->ID}"
    );
    if($steps) {
    foreach($steps as $step) {
    if($step->class == 'BCSPersonalDetailsFormStep') {
    $member = new Member();
    $data = $step->loadData();
    if($data) {
    $member->update($data);
    $member->write();
    }
    }
    if($step->class == 'BCSOrganisationDetailsFormStep') {
    $organisation = new Organisation();
    $data = $step->loadData();
    if($data) {
    $organisation->update($data);
    if($member && $member->ID) {
    $organisation->MemberID = $member->ID;
    }
    $organisation->write();
    }
    }
    // Shows the step data (unserialized by loadData)
    // Debug::show($step->loadData());
    }
    }
    $controller = $this->getController();
    $controller->redirect($controller->Link() . 'finished');
    }
    }

    class BCSPersonalDetailsFormStep extends MultiFormStep {
    public static $next_steps = 'BCSOrganisationDetailsFormStep';
    function getFields() {
    return new FieldList(
    new TextField('FirstName', 'First name'),
    new TextField('Surname', 'Surname')
    );
    }
    }

    class BCSOrganisationDetailsFormStep extends MultiFormStep {
    public static $is_final_step = true;
    }

  • martimiz
    Avatar
    Forum Moderator
    1086 Posts

    Re: Multistep Form Not Progressing (tutorial out of date)? Link to this post

    The tutorial at least isn't up to date for SilverStripe 3.1, like you already noticed. It would probably be a good idea to report this as an issue here:

    https://github.com/silverstripe/silverstripe-multiform/issues

  • Bimble
    Avatar
    Community Member
    16 Posts

    Re: Multistep Form Not Progressing (tutorial out of date)? Link to this post

    Thanks Martimiz, I have done so now.

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