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

setEmptyString and nested DOM


Go to End


2 Posts   1322 Views

Avatar
patte

Community Member, 63 Posts

2 July 2010 at 11:18pm

Edited: 02/07/2010 11:21pm

Hi,

using nested DOM with SimpleTreeDropdownField the setEmptyString is not working anymore...

Can someone please enlighten me whats wrong with my code??

Thanks much in advance

patte ;-)

	function getCMSFields()
	{
	return new FieldSet(
		$dropdown = new SimpleTreeDropdownField("MyUrlID", "Bitte waehlen Sie das Ziel aus", "SiteTree"),
		new TextField('Ueberschrift'),
		new SimpleWysiwygField('Beschreibung'),
		new ImageField('Bild'),
		new FileDataObjectManager(
			$this,
			'Downloads',
			'Download',
			'Attachment',
			array('Name' => 'Name','Description' => 'Description')
			)		
		);
	$dropdown->setEmptyString('-- Please select --');
	}

UPDATE: sorry guys, problems resolved

	function getCMSFields()
	{
	$f = new FieldSet(
		$dropdown = new SimpleTreeDropdownField("MyUrlID", "Bitte waehlen Sie das Ziel aus", "SiteTree"),
		new TextField('Ueberschrift'),
		new SimpleWysiwygField('Beschreibung'),
		new ImageField('Bild'),
		new FileDataObjectManager(
			$this,
			'Downloads',
			'Download',
			'Attachment',
			array('Name' => 'Name','Description' => 'Description')
			)		
		);
		$dropdown->setEmptyString('-- Please select --');
		return $f;
	}

Avatar
UncleCheese

Forum Moderator, 4102 Posts

3 July 2010 at 2:06am

Please note that the OP was returning a value before the setEmptyString() method, so it was never executed.