Hi, I've posted about this before but never had a definitive answer and was hoping someone could help me get to the bottom of this.
I'm stuck on trying to get a multiform to skip a step, I have tried setting up an SS site using version 2.3.4 as a test area and building a brand new multiform and adding in the conditional statements to skip steps and I'm having no joy what so ever.
I have set up four steps with drop downs in each form so I can select which step to jump to.
I've tried using two methods to achieve this as seen in the documentation http://doc.silverstripe.org/doku.php?id=modules:multiform#getnextstep and http://doc.silverstripe.org/doku.php?id=modules:multiform&rev=1209417500#getnextstep:
class MyStep extends MultiFormStep
// ...
public function getNextStep() {
if($this->loadData()->Condition) {
return 'TestThirdCase1Step';
} else {
return 'TestThirdCase2Step';
}
}
// ...
}
and
class MyStep extends MultiFormStep
// ...
public function getNextStep() {
$data = $this->loadData();
if($data['Gender'] == 'Male') {
return 'TestThirdCase1Step';
} else {
return 'TestThirdCase2Step';
}
}
// ...
Here is my code so far for the part where I want to skip the next step:
<?php
class FirstStep extends MultiFormStep{
protected $title = 'First Step';
// protected static $next_steps = 'SecondStep';
function getFields(){
$fields = singleton('First')->getFrontEndFields();
return $fields;
}
public function getNextStep(){
$data = $this->loadData();
$option = $data['DropDownOne'];
if($option == 'OptionThree'){
return 'ThirdStep';
} else {
return 'SecondStep';
}
}
}
?>
If it helps anyone to know, when I go to the next step after selecting 'option three' the back button disappears.
Thanks