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;
}