Php SilverStripe DropdownField默认值设置为空
有人能帮我在SilverStripe 3中的Php SilverStripe DropdownField默认值设置为空,php,dropdown,silverstripe,Php,Dropdown,Silverstripe,有人能帮我在SilverStripe 3中的下拉字段中设置默认为空吗 目前我的代码如下: DropdownField::create( 'HowHear', 'How did you hear of this job?', array( 'Indeed' => 'Indeed', 'Caterer' => 'Caterer', 'Gumtree' => 'Gumtree', 'Word of
下拉字段中设置默认为空吗
目前我的代码如下:
DropdownField::create(
'HowHear',
'How did you hear of this job?',
array(
'Indeed' => 'Indeed',
'Caterer' => 'Caterer',
'Gumtree' => 'Gumtree',
'Word of mouth' => 'Word of mouth',
'Other' => 'Other',
)
)->addExtraClass('full-width'),
在SilverStripe 3和4中,DropdownField有一个函数可以设置默认的空字符串:
DropdownField::create(
'HowHear',
'How did you hear of this job?',
[
'Indeed' => 'Indeed',
'Caterer' => 'Caterer',
'Gumtree' => 'Gumtree',
'Word of mouth' => 'Word of mouth',
'Other' => 'Other',
]
)->addExtraClass('full-width')->setEmptyString('')
在SilverStripe 3和4中,DropdownField有一个函数可以设置默认的空字符串:
DropdownField::create(
'HowHear',
'How did you hear of this job?',
[
'Indeed' => 'Indeed',
'Caterer' => 'Caterer',
'Gumtree' => 'Gumtree',
'Word of mouth' => 'Word of mouth',
'Other' => 'Other',
]
)->addExtraClass('full-width')->setEmptyString('')