Actually, I have noticed on closer inspection that the dropdown field are indeed saving to the database, however the managers name is not displaying in the HasManyComplexTableField,
<?php
/**
* Defines the ProjectHolder page type
*/
class ProjectHolder extends Page {
static $db = array(
);
static $has_one = array(
);
static $has_many = array(
'Projects' => 'Project',
'Managers' => 'Manager'
);
function getCMSFields() {
$fields = parent::getCMSFields();
$tablefield = new HasManyComplexTableField(
$this,
'Projects',
'Project',
array(
'title' => 'Title',
'Manager' => 'Manager'
),
'getCMSFields_forPopup'
);
$tablefield->setAddTitle( 'A Project' );
$managertablefield = new HasManyComplexTableField(
$this,
'Managers',
'Manager',
array(
'name' => 'Name',
),
'getCMSFields_forPopup'
);
$managertablefield->setAddTitle( 'A Manager' );
$fields->addFieldToTab( 'Root.Content.Projects', $tablefield );
$fields->addFieldToTab( 'Root.Content.Managers', $managertablefield );
return $fields;
}
}
class ProjectHolder_Controller extends Page_Controller {
}
?>
I notice that having
$tablefield = new HasManyComplexTableField(
$this,
'Projects',
'Project',
array(
'title' => 'Title',
'ManagerID' => 'Manager'
),
displays the Id no in the table, but is there a way to get it to display the saved manager's name?