6

我正在尝试将 rails 表单放入引导模式对话框中。我想使用模态页脚来保存取消/提交按钮,但这似乎在表单标签内不起作用。

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

1 回答 1

11

那是因为您将页脚放在正文中。改用这种方式:

<%= 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 %>
于 2012-10-29T17:45:40.217 回答