我正在使用带有 turbolinks 的 bootstrap 3,问题是,当我按下编辑表单中的提交按钮时,什么也没有发生,但是如果我重新加载页面,每个输入都提交得很好。我不明白为什么会发生这种情况,我什至没有在表单中使用 javascript。这是代码:
<div class = "row">
<%= semantic_form_for @post do |f| %>
<%= f.semantic_errors %>
<div class = "form-group">
<div class = "col-lg-9 col-md-7">
<%= f.input :title, :label => "Title" %>
<%= f.input :content, :as => :rich, :allow_embeds => true %>
<%= f.input :cat_list, :label => "Type your tags here" %>
</div>
<div class = "col-lg-3 col-md-4 ">
<p>
<%= image_tag(@post.thumbnail.url(:original), :class => "img-thumbnail") %>
</p>
<p>
<%= f.input :thumbnail, as: :file %>
</p>
<p>
<%= f.select :tag_list, Post::Tags, { }, { :multiple => true, :size => 10, :class => "form-control" } %>
</p>
</div>
<%= f.action :submit, :as => :button, :button_html => { :class => "btn btn-primary" } %>
</div>
<% end %>
<%= link_to 'Show', @post %> |
<%= link_to 'Back', posts_path %>
这是我的 application.js 的内容:
//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require bootstrap
//= require_tree .
最佳答案
我有一个类似的问题:每当使用 link_to
到达页面时,我不得不刷新。
添加 data-no-turbolink="true"
在 View 的 body 标签内。
通过查看 Form Submit button only works after reload 解决了.
关于ruby-on-rails - Turbolinks 不允许我在不重新加载页面的情况下提交表单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21191478/