Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Data Model Questions /

TreeDropDownField/DropDownField in DataObject does not save related SiteTree


Reply


4 Posts   736 Views

Avatar
spierala

Community Member, 80 Posts

8 May 2013 at 2:36am

Edited: 08/05/2013 2:36am

I just tested on a blank 3.0.5 installation and 3.1 beta 3.
If you have have a DataObject with related SiteTree like this...

private static $has_one = array(
"MySiteTree" => "SiteTree"
);

editing the DataObject... the DropDownField never remembers the selected Page. the same happens with TreeDropDownField.
It looks like it´s always saving the SiteTreeID of the Page that you are just editing in the CMS.

Is there any solution to this? or is it just a bug?
Thanks,
Florian

Avatar
dizzystuff

Community Member, 93 Posts

17 May 2013 at 6:36pm

I'm having this experience too, with a days-old pull down of the 3.1 branch. Any chance you found an answer or a patch for this spierala? Cheers.

Avatar
Craftnet

Community Member, 58 Posts

27 May 2013 at 11:07pm

Edited: 27/05/2013 11:07pm

If I understand correctly...

public function getCMSFields() {
$fields = parent::getCMSFields();

$obiect = Obiect::get()->map('ID', 'Title');

$fields->addFieldToTab("Root.Main", new DropdownField('ObiectID', 'Płatność za', $obiect));

return $fields;
}


Sorry for my bad English

Avatar
kindlemanwill

Community Member, 68 Posts

15 January 2014 at 1:18pm

Did you ever get a solution for this for the TreeDropdownField - I'm getting the same issue