individual simple_form radio button

Viewed 3500

I am using SimpleForm 3.2.1 with Rails 4. I am trying to convert a rails form into a simple_form. Here is the code that works for radio buttons with the regular rails form:

  <ul class="list-radios list-multiplier">
    <% @organization_plans.each_with_index do |plan, index| %>

      <li>
        <div class="radio custom-radio">
          <%= f.radio_button :plan_id, plan.id, id: "field-rad#{index}", data: {price: plan.total_price} %>

          <label class="form-label" for='field-rad<%= index %>'>
            <span></span>

            <%= plan.description %>
          </label>
        </div><!-- /.radio -->
      </li>
    <% end %>
  </ul><!-- /.list-radios -->

I have tried converting it to SimpleForm with the following code:

  <ul class="list-radios list-multiplier">
    <% @organization_plans.each_with_index do |plan, index| %>

      <li>
        <div class="radio custom-radio">
          <%= f.input :plan_id, value: plan.id, input_html: {id: "field-rad#{index}"}, data: {price: plan.total_price}, label: false, as: :radio %>

          <label class="form-label" for='field-rad<%= index %>'>
            <span></span>

            <%= plan.description %>
          </label>
        </div><!-- /.radio -->
      </li>
    <% end %>
  </ul><!-- /.list-radios -->

However, when I open the page in the browser I get the error:

No input found for radio

How do I get this form to start working with simple_form?

2 Answers
Related