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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

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

SimpleTreeDropdownField optional?


Go to End


5 Posts   1280 Views

Avatar
patte

Community Member, 63 Posts

12 March 2010 at 5:19am

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

Avatar
UncleCheese

Forum Moderator, 4102 Posts

12 March 2010 at 5:30am

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

Avatar
patte

Community Member, 63 Posts

12 March 2010 at 5:42am

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")
		);
	}

Avatar
UncleCheese

Forum Moderator, 4102 Posts

12 March 2010 at 6:03am

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

Avatar
patte

Community Member, 63 Posts

12 March 2010 at 10:14pm

UncleCheese, you`re the best! Thanks much