在我的一个crud控制器中,我尝试执行以下操作为select选择添加占位符(禁用所选选项)
$this->crud->addFields([
[
'name' => 'measurement_id',
'label' => 'Measurement',
'type' => 'select',
'entity' => 'measurement',
'attribute' => 'name',
'model' => Measurement::class,
'attributes' => [
'placeholder' => 'My placeholder',
],
],
]);
但它不起作用。它生成以下html。
<select name="measurement_id" placeholder="My placeholder">
<option value="1">option1</option>
<option value="2">option2</option>
</select>
有没有办法生成合适的HTML?
<select name="measurement_id">
<option disabled selected>My placeholder</option>
<option value="1">option1</option>
<option value="2">option2</option>
</select>