Rails Form in Bootstrap Modal

ruby-on-rails, ruby-on-rails-3.2, twitter-bootstrap

Solution

That's because you are putting the footer inside the body. Use this way instead:

<%= simple_form_for [@state, @search] do |f| %>
  <div class="modal-body">
    <!-- long form here -->
  </div>
  <div class="modal-footer">
    <button class="btn" data-dismiss="modal" aria-hidden="true">Cancel</button>
    <%= f.button :submit, :class => 'btn btn-primary' %>
  </div>
<% end %>

Problem

I'm trying to put a rails form in a bootstrap modal dialog. I'd like to use the modal-footer to hold the cancel/submit buttons, but this doesn't seem to work inside the form tag. ``` <div class="modal-body"> <%= simple_form_for [@state, @search] do |f| %> <!-- long form here --> <div class="modal-footer"> <button class="btn" data-dismiss="modal" aria-hidden="true">Cancel</button> <%= f.button :submit, :class => 'btn btn-primary' %> </div> <% end %> </div> ```

Original source