Simple formal radio buttons - displays embedded

I am trying to use Simple Form in my Rails 4 application (with bootstrap tweet).

I have this line on my form. This is a yes or no question. I want the button to be embedded in the label. At this point, the button appears above the label (so there are 4 lines, for the button, Yes, button, No).

 <%= f.collection_radio_buttons :project_image, [[true, '  Yes'] ,[false, '  No']], :first, :last, :inline,  {:class => "create-project", :style=> 'width: 650px' }  %>

      

I must also say that I have tried the solutions posted here:    simple_form_for rails radio button inline and tried this line:

<%= f.collection_radio_buttons :project_image, [[true, '  Yes'] ,[false, '  No']], :first, :last, {:inline_label=> true}, {:class => "create-project", :style=> 'width: 650px' }  %>

      

Checking that google shows that there are separate and tags.

I was unable to get it to do inline. Please can you help me understand how to make the radio buttons line up above.

In response to the suggestion below about adding bootstrap style to a simple form. I tried:

     <label class="checkbox-inline">
      <%= f.collection_radio_buttons :project_image, [[true, '  Yes'] ,[false, '  No']], :first, :last,  {:item_wrapper_class => 'inline'}, {:class => "create-project", :style=> 'width: 650px' }  %>
  </label>

      

The result of the above was a slightly indented segment, but it still wasn't rendered. Thanks you

+3


source to share


2 answers


Add a built-in radio to your switches .



Refer: http://getbootstrap.com/css/#forms

+3


source


If the above doesn't work for you, try:



<%= f.collection_radio_buttons :project_image, [[true, 'Yes'] ,[false, 'No']], :first, :last) do |b| b.label { b.radio_button + b.text } %>

      

0


source







All Articles