Jump to:

5450 Posts in 1672 Topics by 1197 members

Customising the CMS

SilverStripe Forums » Customising the CMS » [solved] Displaying current value of TreeDropDown

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 1196 Views
  • netnoise
    Avatar
    Community Member
    10 Posts

    [solved] Displaying current value of TreeDropDown Link to this post

    How can I make the TreeDropDownField to display the currently selected item upon page load? It says "Choose..." even though a value for the field is set.

    $tree = new TreeDropdownField('MyFile', 'Selected File', 'File', 'ID');
    $tree->setTreeBaseID(3);

    $fields = parent::getCMSFields();
    $fields->addFieldToTab('Root.Content.Main', $tree, 'Content');

    Am I missing something or is there any workaround?

  • netnoise
    Avatar
    Community Member
    10 Posts

    Re: [solved] Displaying current value of TreeDropDown Link to this post

    My code was wrong. The field name MyFileID must be used instead of MyFile:

    $tree = new TreeDropdownField('MyFileID', 'SelectedFile', 'File', 'ID');

    1196 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.