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.