17488 Posts in 4473 Topics by 1978 members
| Go to End | ||
| Author | Topic: | 6575 Views |
-
Re: using DataObject::get() to fill dropdown in getCMSFields_forPopup()

24 August 2008 at 10:41am
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?
| 6575 Views | ||
| Go to Top |

