Rails Form in Bootstrap Modal

I am trying to put a rails form in a modal loading dialog. I would like to use modal-footer to hold cancel / submit buttons, but this does not 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> 
+6
source share
1 answer

This is because you place the footer inside the body. Use 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 %> 
+10
source

All Articles