Hi,
I am trying to create a staff profile page and use a DropDownField for the $Location via a pop-up window in the CMS. This is what I have done so far but I am not sure where to add an array for the office locations (i.e. wellington, auckland, christchurch, london) so the dropdown menu are populated with values.
Any help would be awesome :)
<?php
class Staff extends DataObject {
static $db = array(
'FirstName' => 'Text',
'LastName' => 'Text',
'Email' => 'Text',
'Location' => 'Varchar(100)',
'JobTitle' => 'Text',
'JobDescription' => 'Text',
);
static $has_one = array(
'Page' => 'StaffPage',
'StaffProfileImage' => 'CustomImage',
'Location' => 'Location',
);
static $fields = array(
'FirstName' => 'FirstName',
'LastName' => 'LastName',
'Email' => 'Email',
'JobTitle' => 'JobTitle',
'JobDescription' => 'JobDescription',
);
public function getCMSFields_forPopup() {
$fields = new FieldSet();
$fields->push(new TextField('FirstName', 'First name'));
$fields->push(new TextField('LastName', 'Last name'));
$fields->push(new DropDownField('Location', 'Location'));
$fields->push(new TextField('Email'));
$fields->push(new TextField('JobTitle', 'Job Title'));
$fields->push(new TextareaField('JobDescription', 'Job Description - write a couple of paragraphs to describe your role at CDP.'));
$fields->push(new ImageField('StaffProfileImage', 'Staff profile image'));
return $fields;
}
}
?>
P.S. I did find this link (http://silverstripe.org/archive/show/141863#post141863) but wasn't able to reply as topic was archived.
- Rich McNabb