10377 Posts in 2193 Topics by 1709 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1352 Views |
-
Multiform module, conditional statements

3 March 2010 at 12:25pm
Hi,
I've been trying to jump a step in my multi form, please see code below:
First.php
<?php
class First extends DataObject{
static $db = array (
'Firststepfield' => 'Text',
'DropDownOne' => 'Text',
);static $field_labels = array(
'Firststepfield' => 'First step field',
);public function getFrontendFields(){
$fields = $this->scaffoldFormFields(array(
'restrictFields' => array(
'Firststepfield',
),
'fieldClasses' => array(
'Firststepfield' => 'TextField',
)
)
);
$FirstChoiceArray = array(
'OptionOne' => 'Option one' ,
'OptionTwo' => 'Option two',
'OptionThree' => 'Option three',
'OptionFour' => 'Option four'
);$fields->push( new DropdownField( 'DropDownOne', 'Drop down one', $FirstChoiceArray ) );
return $fields;
}
}?>
FirstStep.php
<?php
class FirstStep extends MultiFormStep{
//protected static $next_steps = 'SecondStep';function getFields(){
$fields = singleton('First')->getFrontEndFields();
return $fields;
}public function getNextStep(){
$data = $this->loadData();
// if self
if($data['DropDownOne'] == 'OptionThree'){
return 'ThirdStep';
} else {
// if othe than self
return 'SecondStep';
}
}
}?>
when I echo $data['DropDownOne']; I'm getting "OptionThreeOptionThree" output to the screen. Any ideas why?
basically I'm checking for the value "OptionThree" but this has somehow changed to "OptionThreeOptionThree".
Any help is much appreciated.
-
Re: Multiform module, conditional statements

10 March 2010 at 2:30am
Bump,
Really stuck on this, can't figure out why it is happening. The fact that when I echo $data['DropDownOne'] to the screen it is reoccurring almost suggests there is some kind of loop happening but I don't understand this.
any ideas?
Regards
-
Re: Multiform module, conditional statements

10 March 2010 at 5:12pm
Where are you putting the echo?
If you var_dump($data) does it produce three arrays?
Sean
-
Re: Multiform module, conditional statements

11 March 2010 at 2:00am
Hi Sean,
I've just been writting the echo in the getNextStep() function.
If I do the same with the var_dump it writes the same array out twice.
-
Re: Multiform module, conditional statements

11 February 2013 at 12:04pm
Hey, did you ever resolve this issue? I have a similar problem. Multiform creates two sessions and two steps each time. I see the arrays printed out twice too. Do you know what causes this?
Please help!
| 1352 Views | ||
|
Page:
1
|
Go to Top |


