1

我正在尝试创建内联单选按钮,该按钮也具有内联标签(在最左侧)。

正如我在标题中所说,使用 Bootstrap 和 SimpleForm。

我的代码如下所示:

<%= f.input :breakdown_or_size, 
            :collection => ["Breakdown", "Manual"],
            :as => :radio_buttons, 
            :item_wrapper_class => 'inline',
            :label => 'Select One: ' %>

这就是我得到的:

标签下方的单选按钮
(来源:webpagescreenshot.info

4

1 回答 1

0

我为 simple_form_for 寻求帮助。最后我找不到任何东西,但至少使用 form_for 你可以这样做:

<%= form_for(@book) do |f| %>
  <% if @book.errors.any? %>
  <div id="error_explanation">
  <h2><%= pluralize(@book.errors.count, "error") %> prohibited this book from being saved:</h2>

    <ul>
    <% @book.errors.full_messages.each do |msg| %>
      <li><%= msg %></li>
    <% end %>
    </ul>
  </div>
<% end %>

<div class="actions", style='inline'>

  <%= f.label 'Select One: ' %>
  <br/>
  <%= f.radio_button :collection, "Breakdown" %> Breakdown
  <%= f.radio_button :collection, "Manual" %> Manual
  <br/>
  <%= f.submit %>
</div>

这至少解决了内联渲染。

于 2013-04-18T10:18:57.063 回答