Jump to:

5450 Posts in 1672 Topics by 1197 members

Customising the CMS

SilverStripe Forums » Customising the CMS » SOLVED?? Multiform / action templates

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

Page: 1
Go to End
Author Topic: 1150 Views
  • Vromepiet
    Avatar
    Community Member
    11 Posts

    SOLVED?? Multiform / action templates Link to this post

    Hello,

    I'm quite new to Silverstripe and currently trying to make a module where 2 different kinds of users can register themselves or edit their profile.

    To achieve this, I would like to use the multiform module. I installed it and it works using the kind of procedure described in the tutorials and the silverstripe book (using a specific page for the registration, which can be placed in the menu).

    However, I tried to make a user registration proces similar to the one in the forum module, using a "register" action in a "BusinessUser" page controller, without a specific page. It then shows step 1 of the form correctly, but doesn't proceed to step 2.

    Can anyone please explain a bit what's going wrong here (so that I learn a bit more about the idea behind the system) and probably give a suggestion how to deal with it?

    class BusinessRegistrationMultiForm extends MultiForm {
    public static $start_step = 'BusinessRegistrationFirstStep';

    // ...
    }

    class BusinessRegistrationFirstStep extends MultiFormStep {
       public static $next_steps = 'BusinessRegistrationLastStep';
       
       function getFields() {
          $fields = singleton( 'Member' )->getBusinessFirstFields();
          return $fields;
       }
    }

    class MemberProfile extends Page_Controller {

    function register() {
    return array(
    "Title" => 'titel',
    "Subtitle" => 'Register',
    );
    }

    function Link($action = null) {
    return "$this->class/$action";
    }

    }

    class BusinessProfile extends MemberProfile {

       function BusinessRegistrationForm() {
          return new BusinessRegistrationMultiForm($this, 'BusinessRegistrationForm');
       }
    }

    And then in BusinessProfile_register.ss

    $Content
    <p>Hi</p>
    <div id="UserProfile">
       <% if CurrentMember %>
          <p><% _t('PLEASELOGOUT', 'Please logout before you register') %> - <a href="Security/logout"><% _t('LOGOUT', 'Logout') %></a></p>
       <% else %>
          $BusinessRegistrationForm
       <% end_if %>
    </div>

    Thanks, Jeroen.

  • Vromepiet
    Avatar
    Community Member
    11 Posts

    Re: SOLVED?? Multiform / action templates Link to this post

    SOLVED??

    I added the following code to all steps:

    public function Link() {
    return Controller::curr()->Link() . 'register?MultiFormSessionID=' . $this->Session()->Hash;
    }

    It works, but shouldn't this be handled by the multiform module itself? Why does it cutoff the "register" (action) part if I don't include this code in the steps?

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