SilverStripe DropdownField 默认值设置为空白
SilverStripe DropdownField default value set to blank
谁能帮我在 SilverStripe 3 的 DropdownField
中将空白设置为默认值?
目前这是我的代码:
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
有一个函数 setEmptyString('')
将设置默认的空字符串:
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 的 DropdownField
中将空白设置为默认值?
目前这是我的代码:
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
有一个函数 setEmptyString('')
将设置默认的空字符串:
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('')