Hey there,
I'm trying to use the value from a DropDownField, integrated in the backend, in the frontend.
Therefore I created a DataObject named "Industry". This DataObject hast the value "Name" (see code below):
class Industry extends DataObject {
static $db = array (
'Name' => 'Text'
);
public function getCMSFields_forPopup() {
return new FieldSet(new TextField('Name'));
}
}
In the backend, the DropDownField is integrated the following way:
class ProjectPage extends Page {
static $has_one = array(
'IndustryID' => 'Industry'
);
public function getCMSFields() {
$fields = parent::getCMSFields();
$industries = DataObject::get('Industry')->toDropDownMap('ID', 'Name');
$fields->addFieldToTab('Root.Content.Main', new DropdownField('IndustryID', 'Industry', $industries, $this), 'Content');
return $fields;
}
}
class ProjectPage_Controller extends Page_Controller {}
Now I've got the problem, that the value of the frontend is not saved when I change it in the backend and the second thing is, that I can't the the name of the choosen Industry through the frontend.
Can anyone please help me? Thanks.