21278 Posts in 5728 Topics by 2599 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1143 Views |
-
Multiform skip step not working

12 April 2010 at 12:29am Last edited: 12 April 2010 12:31am
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
-
Re: Multiform skip step not working

12 April 2010 at 12:43am
Just figured something out,
- if on the first step I choose 'option three' it takes me to the second step but looses the back button.
- If I hit next it takes me to the third step which has a back button.
- If I then click back it takes me to step one, and if I click next it takes me to step three and so on.
So to conclude that, after selecting 'option three' in step one and then on step two I have clicked next, the form behaves correctly, sort of.
Hope that sheds some more light on this. I'm probably doing something silly here but all the code seems fine according to the documentation.
Cheers
- if on the first step I choose 'option three' it takes me to the second step but looses the back button.
-
Re: Multiform skip step not working

26 April 2010 at 10:45am
Sorry to regurgitate this one but does anyone have any idea why my skipping a step will not work?
I'm really stuck on this one and desperately need some help or a push in the right direction.
Any responses are greatly appreciated
Thanks
| 1143 Views | ||
|
Page:
1
|
Go to Top |

