Zakoff
Zakoff

Reputation: 12995

Inline dropdown in form with bootstrap

I am trying to create an inline form with twitter bootstrap. When I do the following, the text fields are all inline but the dropdown button is not. Instead the dropdown button is as wide as the screen. How can I make it inline too?

    <%= form_for @project, {:class => "form-inline"} do |f| %>
      <%= render 'shared/error_messages', :object => f.object %>

      <%= f.text_field :a, :class=> "input-small", :placeholder=>"a" %>

      <%= f.text_field :b, :class=> "input-small", :placeholder=>"b" %>

      <%= f.text_field :c, :class=> "input-small", :placeholder=>"c" %>

      <%= f.text_field :d, :class=> "input-small", :placeholder=>"d" %>

      <%= f.text_field :e, :class=> "input-small", :placeholder=>"e" %>

      <%= f.label :one_two %>
      <%= f.select :one_two, options_for_select([['One','One'],['Two',Two]]) %>

      <%= f.submit "Submit", :class => "btn"  %>
    <% end %>
  </div>
</div>

Upvotes: 0

Views: 2043

Answers (1)

Prashanth
Prashanth

Reputation: 1398

Maybe you could try the following to wrap the select tag.

<div class="control-group">
            <label class="control-label"><%= f.label :one_two %></label>
            <div class="controls">                 
                 <%= f.select :one_two, options_for_select([['One','One'],['Two',Two]]) %>
            </div>
</div>

Upvotes: 1

Related Questions