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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

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   1180 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