为什么CakePHP表单帮助器分组我的表单单选项


Why is CakePHP Form helper grouping my form radio options?

echo $this->Form->create('AmazonMatches', array('action' => 'selectMatches'));
echo $this->Form->input('option_id', array('options' => $allAmazonMatches, 'type' => 'radio'));
echo $this->Form->end(__('Submit', true));

现在我看到我的单选按钮周围有一个大的红色文本框,上面写着"选项Id"。

我怎样才能摆脱它?对不起,我对蛋糕一窍不通。

如果你不想显示,你需要将'legend'选项设置为false;如果你想自定义消息,你需要将'legend'选项设置为字符串:

echo $this->Form->input('option_id', array(
    'options' => $allAmazonMatches,
    'type' => 'radio',
    'legend' => false
));
$this->Form->input

使用提供的id创建一个输入字段。为了使复选框单独工作,您必须创建多个输入。可能有更好的方法,但是像这样做是可行的。

foreach($allAmazonMatches as $amazonMatch)
{
  $this->Form->input...
}