简体   繁体   中英

Formtastic radio button issue

I have the following code in my views

<%= semantic_form_for @instance do |f| %> <!-- formtastic gem form creation -->
  <%= f.inputs do %>
    <%= f.input :name %>
    <%= f.input :foo, :label => "dType", as: :radio, collection: [ ["val1", false], ["val2", false] ] %>
    <%# strange bug omitting first letter of label %>
    <br>
  <% end %>
  <%= f.buttons do %>
    <%= f.commit_button %>
  <% end %>
<% end %>

Two issues. First, I'm getting a strange bug that's omitting the first letter of the label. Second, you have to click at least twice on a button (other than the first button) to get that button selected. Thanks in advance

Rails 3.1.1 and Formtastic 2.0.2

You're mixing hash syntaxes... you start out using classic Ruby hashrocket style (:eg => this), but then you throw in a JSON-style (as: :radio). Pick one and be consistent.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM