5093 Posts in 1516 Topics by 1113 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 682 Views |
-
Admin DropDown for ParentPage of DataObject

24 February 2011 at 10:52am Last edited: 24 February 2011 10:55am
Following Situation
I have Dataobjects "Project" which have "has_one" relations to "ProjectPage"
following code in the dataobject projects:
public function getCMSFields_forPopup()
{
$pData = (DataObject::get('ProjectPage'));if ($pData) {
$ProjectPageSource = $pData->toDropDownMap();
}$fields->push(new DropdownField(
'ProjectPage',
'ProjectPage',
$ProjectPageSource,
$this
));....}
In the Admin it renders a perfect DropDown List of all my other ProjectPage Pages.
Sadly it never saves!I think i remember that i'm suppost to use "ProjectPageID" as first Argument to "DropdownFiled" - but then i get an empty DropDown Box.
Where's my Bug?
Thanks a Lot
-
Re: Admin DropDown for ParentPage of DataObject

24 February 2011 at 8:18pm
I think i remember that i'm suppost to use "ProjectPageID" as first Argument to "DropdownFiled" - but then i get an empty DropDown Box.
You should use the ProjectPageID name for the has_one. It shouldn't stop loading the pages from that as you're passing the pages in manually. Do you get an error when using ProjectPageID?
-
Re: Admin DropDown for ParentPage of DataObject

17 March 2011 at 3:13pm Last edited: 17 March 2011 3:14pm
If i use ProjectPageID the DropDown disapears in Admin with no error message
$fields->push(new DropdownField(
'ProjectPageID',
'Zugehörige Projektseite auswählen',
$ProjectPageSource,
$this
));I am really stuck on this one...
-
Re: Admin DropDown for ParentPage of DataObject

17 March 2011 at 5:03pm Last edited: 17 March 2011 5:09pm
I added the following Workaround to the DataObject!
Like this i am able to reassign the DataObject to a new Page!public function onBeforeWrite()
{
$this->ProjectPageID = $this->ProjectPage;
parent::onBeforeWrite();
}Thanks for all the help on IRC! (especially Willr and DesignCity) You Rock!
| 682 Views | ||
|
Page:
1
|
Go to Top |

