【发布时间】:2011-01-08 08:07:06
【问题描述】:
我一直在查看Cookbook - 7.3.3 Automagic Form Elements,试图找到一种方法让单选按钮水平排列而不是垂直排列。我一直在查看'div' => 'class_name' $options 以及$options[‘between’]、$options[‘separator’] 和$options[‘after’],但没有成功。有这样做的“蛋糕”方式吗?
<?=$form->input('Product Type', array(
'type' => 'radio',
'id' => $tire['ProductType']['id'],
'name' => $tire['ProductType']['id'],
'options' => array(2=>'Tire Manufacturer', 7=>'Rim Manufacturer '),
));?>
等价于这个
<label>Product Type</label>
<div style="padding-top:5px;">
<input type="radio" name="data[Manufacturer][product_type_id]" value="<?=$tire['ProductType']['id']?>"> Tire Manufacturer
<input type="radio" name="data[Manufacturer][product_type_id]" value="<?=$wheel['ProductType']['id']?>"> Rim Manufacturer
</div>
【问题讨论】:
-
CakePHP 3 更新:分隔符、中间和图例选项已从 radio() 中删除。您现在可以使用模板来更改包装 HTML。 See this answer
标签: cakephp radio-button