【发布时间】:2015-02-04 02:55:17
【问题描述】:
我正在使用 CakePHP3
我无法解读有关使用单选按钮创建结果列表的文档。
我尝试过这种方式:
foreach ($userGroups as $group_id => $group) {
echo $this->Form->radio("UserGroup.$group_id.id", ['value' => $group_id, 'label' => $group]);
}
这说明您需要做的就是将类型设置为无线电。但我检查了 api 和它looks like it will unset the type。
反正我试过了
echo $this->Form->select("user_circle_id", $userGroups, ['type' => 'radio']);
没有任何作用。
请指教。
更新:
$userGroups = [1 => 'Group 1', 2 => 'Group 2']; // basically primary key is keys and the display fields are the values.
【问题讨论】:
标签: forms cakephp cakephp-3.0