Hi everyone
I want todo something like this...
$CategoriesSource = $oData->toDropDownMap('ID','Name' && 'CarNumber');
I have also tried
$CategoriesSource = $oData->toDropDownMap('ID','Name' . 'CarNumber');
Neither works, however this works...
$CategoriesSource = $oData->toDropDownMap('ID','CarNumber');
The other just preduce blank values in the drop down.
Any ideas?
function getCMSFields_forPopup() {
$fields = new FieldSet();
$oData = (DataObject::get('Season','','','',''));
if ($oData) {
$CategoriesSource = $oData->toDropDownMap('ID','Year');
} else {
// no categories there yet, might put a literalfield to tell the user
}
$dropdown = new DropdownField('SeasonID', 'Season', $CategoriesSource, $this->SeasonID);
$fields->push($dropdown);
$oData = (DataObject::get('Team','','','LEFT JOIN `Event_Teams` ON `Event_Teams`.TeamID=`Team`.ID',''));
if ($oData) {
$CategoriesSource = $oData->toDropDownMap('ID','CarNumber');
} else {
// no categories there yet, might put a literalfield to tell the user
}
$dropdown = new DropdownField('TeamID', 'Team', $CategoriesSource, $this->TeamID);
$fields->push($dropdown);
$fields->push(new NumericField('Position'));
$fields->push(new NumericField('Points'));
return $fields;
}