标签标签包装单选按钮中的输入标签(Simple_form) [英] Label tag wrapping Input tag in radio buttons (Simple_form)
本文介绍了标签标签包装单选按钮中的输入标签(Simple_form)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用带有 Rails 的 gem simple_form 来创建我的表单.
I'm using the gem simple_form with Rails to create my forms.
我想创建将 input 标签包裹在 label 标签中的 radio_buttons,例如:
I want to create radio_buttons that have the input tag wrapped in the label tag, for example:
<label>
<input id="optionsRadios2" name="optionsRadios" value="option2" type="radio"/>
Option one
</label>
但我得到的是:
<input id="optionsRadios" name="optionsRadios" value="option2" type="radio"/>
<label for="optionsRadios1"> Option one</label>
有没有办法使用包装器在标签标签内创建输入标签?如何?
Is there a way to create the input tag inside label tag using wrappers? how?
我现在找不到任何方法(这里是文档:http://www.rubydoc.info/github/plataformatec/simple_form/master/SimpleForm/FormBuilder:collection_radio_buttons)
I could not find any ways by now (here is the doc: http://www.rubydoc.info/github/plataformatec/simple_form/master/SimpleForm/FormBuilder:collection_radio_buttons)
感谢您的帮助!
推荐答案
试试这个:
<%= f.collection_radio_buttons :options, [[true, 'Yes'] ,[false, 'No']], :optionsRadios1, :optionsRadios2, {:item_wrapper_class => 'inline'}, {:class => "radio-inline" }%>
这篇关于标签标签包装单选按钮中的输入标签(Simple_form)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文