我想为自动创建的datepicker formgroup的所有选择添加一个类。
<?= $this->Form->input('hide', ['class'=>'classtoadd' ]); ?>
结果是:
<div class="input date">
<label>Hide</label>
<select name="hide[year]">
<option value="" selected="selected"></option>
<option value="2020">2020</option>
...
</select>
<select name="hide[month]">
<option value="" selected="selected"></option>
<option value="01">Januar</option>
...
</select>
<select name="hide[day]">
<option value="" selected="selected"></option>
<option value="01">1</option><option value="02">2</option>
</select>
</div>
选择中缺少类classtoadd
。这完全适用于简单的输入。这是预期的行为还是我做错了什么?
我正在使用cakephp 3.0.8。
谢谢!
答案 0 :(得分:0)
echo $this->Form->time('released', [
'interval' => 15,
'hour' => [
'class' => 'foo-class',
],
'minute' => [
'class' => 'bar-class',
],
]);
打印=&GT;
<select name="released[hour]" class="foo-class">
<option value="" selected="selected"></option>
<option value="00">0</option>
<option value="01">1</option>
<!-- .. snipped for brevity .. -->
<option value="22">22</option>
<option value="23">23</option>
</select>
<select name="released[minute]" class="bar-class">
<option value="" selected="selected"></option>
<option value="00">00</option>
<option value="15">15</option>
<option value="30">30</option>
<option value="45">45</option>
</select>