Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Customising the CMS /

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

SOLVED?? Multiform / action templates


Go to End
Reply


2 Posts   1543 Views

Avatar
Vromepiet

Community Member, 11 Posts

1 August 2010 at 2:22am

Edited: 01/08/2010 8:59am

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.

Avatar
Vromepiet

Community Member, 11 Posts

1 August 2010 at 8:58am

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?