Jump to:

7939 Posts in 1472 Topics by 944 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » SimpleTreeDropdownField optional?

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Page: 1
Go to End
Author Topic: 761 Views
  • patte
    Avatar
    Community Member
    63 Posts

    SimpleTreeDropdownField optional? Link to this post

    Hi,

    I am using SimpleTreeDropdownField within DOM.

    Is there a way not to select a page? I want to make the selection optional but the homepage is alway selected per default.

    Thanks much

    patte

  • UncleCheese
    Avatar
    4085 Posts

    Re: SimpleTreeDropdownField optional? Link to this post

    $myDropdown->setEmptyString('-- Please select --');

  • patte
    Avatar
    Community Member
    63 Posts

    Re: SimpleTreeDropdownField optional? Link to this post

    Thanks for your help UncleCheese

    Can you please give me another hint where to place setEmptyString?

    public function getCMSFields_forPopup()
       {
          return new FieldSet(
             new SimpleTreeDropdownField("MyUrlID", "Bitte waehlen Sie das Ziel aus", "SiteTree")
          );
       }

  • UncleCheese
    Avatar
    4085 Posts

    Re: SimpleTreeDropdownField optional? Link to this post

    public function getCMSFields_forPopup()
    {
    $f = new FieldSet(
    $dropdown = new SimpleTreeDropdownField("MyUrlID", "Bitte waehlen Sie das Ziel aus", "SiteTree")
    );
    $dropdown->setEmptyString(...);
    return $f;
    }

  • patte
    Avatar
    Community Member
    63 Posts

    Re: SimpleTreeDropdownField optional? Link to this post

    UncleCheese, you`re the best! Thanks much

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