【发布时间】:2013-04-24 19:30:57
【问题描述】:
我使用带有引导程序的简单表单在 Rails 中创建了这个表单:
<%= simple_form_for @page, :html => { :class => 'page-form' } do |f| %>
<div class="row">
<%= f.input :title, wrapper_html: { class: 'span6'} %>
<%= f.input :url, wrapper_html: { class: 'span3'} %>
<%= f.input :content, input_html: { class: 'wysihtml5 span9' }, wrapper_html: { class: 'span9 row' } %>
<%= f.input :excerpt, input_html: { class: 'wysihtml5 span9 excerpt' }, wrapper_html: { class: 'span9 row'} %>
</div>
<% content_for :sidebar do %>
<div class="page-header">
<h1>Publish</h1>
</div>
<div class="well">
<%= f.input :status , collection: Page::STATUS.map { |s| [s.humanize, s] }, prompt: '- Select page status -' %>
<div class="form-actions">
<%= f.button :submit, :class => 'btn btn-primary' %>
<%= link_to t('.cancel', :default => t("helpers.links.cancel")),
pages_path, :class => 'btn' %>
</div>
</div>
<% end %>
<% end %>
问题是当提交按钮位于content_for 块内时,它不会在单击时更新表单。如果我有这个块之外的按钮,它就可以工作。
有没有办法让它在content_for 块内部工作?我需要它在侧边栏中。
想要的结果图片:
感谢任何提示、答案或有用的 cmets :)
【问题讨论】:
标签: ruby-on-rails forms simple-form