Jump to:

5450 Posts in 1672 Topics by 1197 members

Customising the CMS

SilverStripe Forums » Customising the CMS » TreeDropdownField remove link

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

Page: 1
Go to End
Author Topic: 335 Views
  • dh
    Avatar
    Community Member
    13 Posts

    TreeDropdownField remove link Link to this post

    hi,
    i have a optional TreeDropdownField. how can i remove the link after setting?

  • zenmonkey
    Avatar
    Community Member
    524 Posts

    Re: TreeDropdownField remove link Link to this post

    If this is SS3 you can call the create the field using teh ORM pattern as opposed to the old new TreeDropdownFIeld and then just chain on setEmptyString

    so instead of something like

    $fields->addFieldToTab("Root.Main", new TreeDropdownField("RelationID","Title","SiteTree"));


    you could do

    $fields->addFieldToTab("Root.Main", TreeDropdownField::create("RelationID","Title","SiteTree")->setEmptyString('(Select page)'));

  • theGermaniac
    Avatar
    Community Member
    82 Posts

    Re: TreeDropdownField remove link Link to this post

    Hi. I'm looking also for an solution for that issue.

    Your solution won't work because TreeDropdownField has no method setEmptyString() because its not a child of DropdownField.

    In the forum I came across something like this http://www.silverstripe.org/form-questions/show/5733?start=16, but this wraps the whole tree inside the reset link. Works, but is not very nice.

    Isn't there any easy solution? I wonder that this isn't build in by default

    Cheers, Mario

    335 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.