Rails 4 Turbolinks Make Form Submit Multiple Times

Rails 4 Turbolinks make form submit multiple times

Solved this by moving = javascript_include_tag "application", "data-turbolinks-track" => true from body to head, thanks all your help

Rails remote form submitting multiple times with 'enter'

When using turbolinks, it's important that you add event handlers using the correct method. Do not place any Javascript in your HTML body tag. Use the turbolinks documentation to determine which events you need to hook into to add your own event handlers or make other transformations of page elements.

Current version of turbolinks: https://github.com/turbolinks/turbolinks#full-list-of-events
Older version of turbolinks: https://github.com/turbolinks/turbolinks-classic#events

The current version also has some recommendations on making your document changes idempotent, which I would do for adding event listeners as well.

Devise registration submitting form twice?

Strange issue - the best thing I can suggest is it might be a turbolinks issue

The way to test this will either be to remove Turbolinks from your app for the time being, or to disable turbolinks explicitly on your form. If this works, it will generally mean you have a setting / argument somewhere which will be triggering the turbolinks activity:

#application.js
//= require jquery
//= require jquery_ujs
//= require turbolinks <- remove
//= require twitter/bootstrap
//= require bootstrap-select
//= require moment
//= require bootstrap-datetimepicker
//= require jquery.payment
//= require zeroclipboard
//= require_tree .

#app/views/layouts/application.html.erb
stylesheet_link_tag "application", media: "all"

#app/views/devise/registrations/new.html.erb
<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), html: {class: 'form-signin', role: 'form'}, data: { no_turbolink: true }) do |f| %>


Related Topics



Leave a reply



Submit