这就是我所拥有的:
- 一个带有月份的选择字段
- 一个有年份的精选领域
但是在月份选择字段中,我想添加一个默认选项,例如:
<option value="current">Current</option>
我不知道如何添加默认选项,占位符不是选项。这是我现在的代码,使用 dateType
->add('startDate', DateType::class, [
'label' => 'Start date',
'label_attr' => array('class' => 'sr-only'),
'placeholder' => [
'year' => 'Year',
'month' => 'Month',
],
'years' => range(date('Y')-70, date('Y')),
])
谁能帮我解决这个问题?谢谢!