Manspider
Manspider

Reputation: 353

simple_form bootstrap input

I'm fairly new to html and erb and I'm having problems using customize simple_form.

I need to translate this html.erb input

<%= object.input :attribute, label: 'mylabel' %>

To this html input type

<label class="col-sm-3 control-label">mylabel</label>
<div class="col-sm-9">
  <input class="form-control">
</div>

Upvotes: 0

Views: 64

Answers (1)

Deepak Mahakale
Deepak Mahakale

Reputation: 23661

You need to add :horizontal_forml wrapper and 'form-horizontal' class to form

<%= simple_form_for @post, html: { class: 'form-horizontal' }, wrapper: :horizontal_form do |f| %>
  <%= f.input :attribute, label: 'mylabel' %>
<% end %>

Upvotes: 1

Related Questions