Hi,
I'm trying to insert a DropDownfield into a CMSfield popup in Silverstripe 2.4.
The right value is inserted into the DB after saving. However, the Dropdownfield doesn't stay to the selected item but returns to the first. My code:
class Link extends DataObject{
static $db = array(
'Descript'=> 'Text',
'ExternURL'=> 'Text',
'InternURL'=> 'Varchar'
);
static $has_one = array(
'Pagina' => 'SiteTree'
);
public function getCMSFields_forPopup() {
$fields = parent::getCMSFields();
$fields = new FieldSet(
new TextField('Descript', 'Description'),
new TextField('ExternURL', 'External link (including http://)'),
new DropdownField('InternURL','OR Internal link:', DataObject::get("SiteTree")->toDropdownMap('ID', 'Title', '(Select one)', true))
);
return $fields;
}
}
Anyone a solution?