小编use*_*450的帖子

如何将div添加到单选按钮?

我是 CakePHP 的新用户。我正在尝试添加一些 div 来包含我的输入 + 我的标签。

这就是我所拥有的:

<?php 
$option =  array ("value1" => "labelContent1", "value2" => "abelContent2");
echo $this->Form->input('name', array('type' => 'radio', 'options' =>  $option, 'div' => true, "legend" => false));
?>

<div class="input radio">
    <input type="hidden" name="data[Quiz][name]" id="ModelName_" value=""/>
    <input type="radio" name="data[Quiz][name]" id="ModelName1" value="value1" />
    <label for="ModelName1">labelContent1</label>

    <input type="radio" name="data[Quiz][name]" id="ModelName2" value="value2" />
    <label for="ModelName2">labelContent2</label>
</div>       
Run Code Online (Sandbox Code Playgroud)

这就是我想要的:

<div class="input radio">
    <input type="hidden" name="data[Quiz][name]" id="ModelName_" value=""/>
    <div>
        <input type="radio" name="data[Quiz][name]" id="ModelName1" value="value1" />
        <label for="ModelName1">labelContent1</label>
    </div>
    <div>
        <input type="radio" …
Run Code Online (Sandbox Code Playgroud)

cakephp radio formhelper cakephp-2.0

2
推荐指数
1
解决办法
5610
查看次数

标签 统计

cakephp ×1

cakephp-2.0 ×1

formhelper ×1

radio ×1