Skip to content Skip to sidebar Skip to footer

Simple_form How To Make Accept Terms Checkbox Inline

<%= f.input :terms, :as => :boolean, :label => false, :boolean_style => :inline %> Accept <%= link_to 'Terms of use', terms_path,:remote => true %>

Solution 1:

Here's a rather simple way:

<%= content_for(:the_links) do %>
    Accept <%= link_to "Terms of use", terms_path,:remote => true %> 
    and <%=link_to "privacy Policy", privacy_path, :remote => true%>
<% end %>

<%= simple_form_for @userdo|f| %>
  <%= f.input :email %>
  <%= f.input :password %>
  <%= f.input :terms, :as => :boolean, :label => content_for(:the_links)%> 
<% end%>

the-non-styled-output

Solution 2:

Ensure the checkbox and text are small enough to fit in one row inside the container, then set display: inline; or float:left;

Solution 3:

Try using wrapper_html like this:

<p>
  <%= f.input :terms, 
            :as => :boolean, 
            :label =>false, 
            :boolean_style => :inline,     
            :wrapper_html => { :style =>'display: inline' } 
  %> 
  Accept <%= link_to "Terms of use", terms_path,:remote =>true %> 
  and <%=link_to "privacy Policy", privacy_path, :remote =>true%>
</p>

Post a Comment for "Simple_form How To Make Accept Terms Checkbox Inline"