简体   繁体   中英

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>

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 %>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM