Bootstrap Horizontal Form With Simple Form

Posted By Weston Ganger

I had endless issues trying to get horizontal-form in bootstrap 3 to play nice with simple_form. It doesnt really seem like there is an easy way.

Enter simple_form_bootstrap3. You get alternative methods to use so instead of simple_form_for you can use horizontal_form_for

<%= horizontal_form_for @post do |f| %>
  <%= f.input :name %>
<% end %>

You will have problems if you want to have horizontal and inline fields in the same form, in that case use compact_form_for and add the labels and columns manually

If anyone has a better solution or one that works easily in the regular simple_form gem I would love to hear about it

Article Topic:Software Development - Ruby / Rails

Date:March 18, 2015