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

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

GroupedDropdownField setEmptyString method not working

Go to End



Community Member, 12 Posts

23 August 2017 at 8:44pm

The setEmptyString() method on the GroupedDropDownField class doesn't seem to be working.
I have a DropdownField and GroupedDropdownField for testing purposes, calling setEmptyString() on the DropdownField sets the default value as expected, but calling it on the GroupedDropdownField seems to have no effect.

DropdownField::create('Title', 'Title', array('Mr' => 'Mr','Mrs' => 'Mrs'))->setEmptyString('Test');
GroupedDropdownField::create('GroupedDD', 'GroupedDD', array('Group1' => array('Option1' => 'Option1')))->setEmptyString('Test');

Possible bug, or have I made a mistake somewhere?