在Cakephp中创建单选按钮的表单助手
发布时间:2020-12-13 22:06:42 所属栏目:PHP教程 来源:网络整理
导读:我正在尝试使用Cakephp创建一个单选按钮,就像结果应该类似的那样 div data-attr="radio" id="1" label id="label1"Untitled1/labelbr/ input type="radio" value="option1" id="Radio11" name="Workexperience"/ label for="Radio11"Option1/label input typ
我正在尝试使用Cakephp创建一个单选按钮,就像结果应该类似的那样
<div data-attr="radio" id="1"> <label id="label1">Untitled1</label><br/> <input type="radio" value="option1" id="Radio11" name="Workexperience"/> <label for="Radio11">Option1</label> <input type="radio" value="option2" id="Radio12" name="Workexperience"/> <label for="Radio12">Option2</label> </div> 如何使用Form helper生成如此… 解决方法
这可能有所帮助,
http://book.cakephp.org/view/189/Automagic-Form-Elements#options-before-options-between-options-separator-a-191 对于无线电类型输入,“分隔符”属性可用于注入标记以分隔每个输入/标签对. 代码视图 <?php echo $form->input('field',array( 'before' => '--before--','after' => '--after--','between' => '--between---','separator' => '--separator--','options' => array('1','2'),'type' => 'radio' ));?> 输出: <div class="input"> --before-- <input name="data[User][field]" type="radio" value="1" id="UserField1" /> <label for="UserField1">1</label> --separator-- <input name="data[User][field]" type="radio" value="2" id="UserField2" /> <label for="UserField2">2</label> --between--- --after-- </div> (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |