What I want to do is to select a certain value in a dropdownfield by default based on the value of the parent (that has the exact same dropdownfield). Why can't I get this field to display the parent value by default in the CMS?
public static $db = array(
'ResponsibleOffice' => 'Int'
};
(...)
/**
* Overload so that the default value is same as parent.
* Based on same function in BlogEntry.php
*/
public function populateDefaults() {
parent::populateDefaults();
$this->setField('ResponsibleOffice', $parent->ResponsibleOffice);
}
(...)
public function getCMSFields() {
$fields = parent::getCMSFields();
$options = array('Value1', 'Value2', 'Value3', 'Value4');
$fields->addFieldToTab("Root.Content.Main", new DropdownField("ResponsibleOffice", "Responsible office", $options), 'Content');
return $fields;
}