Multiple inputs on a single line with Twitter Bootstrap and Simple Form 2.0

Posted by noel_g on Stack Overflow See other posts from Stack Overflow or by noel_g
Published on 2012-02-26T00:37:45Z Indexed on 2012/10/17 23:01 UTC
Read the original article Hit count: 274

I am using simple_form 2.0 with twitter bootstrap.

I am trying to determine what is the proper wrapper format in order to get something like [city] [State] [Zip]

I believe my form needs to be

<div class="control-group">
  <%= f.input :city,:wrapper => :small, :placeholder => "City", :input_html => { :class=>"span2", :maxlength => 10},:label => false %>
  <%= f.input :region, :wrapper => :small , :placeholder => "Region", :input_html => { :class=>"span1", :maxlength => 5}, :label => false %>
  <%= f.input :postal_code, :wrapper => :small,  :placeholder => "Postal Code",:input_html => { :class=>"span2", :maxlength => 10},:label => false %>
</div>

I tried this wrapper

  config.wrappers :small, :tag => 'div', :class => 'controls inline-inputs', :error_class => 'error' do |b|
    b.use :placeholder
    b.use :label_input
  end

I believe I would need to define the CSS as well, but before I go down a rabbit hole I thought I would ask if this is built in somewhere.

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about ruby-on-rails-3