Form submitted twice, due to :remote=>true Form submitted twice, due to :remote=>true ruby ruby

Form submitted twice, due to :remote=>true


In case people are stumbling on this question like I did:

I had the same problem, and sannankhalid's answer didn't fix it, but deleting a locally precompiled application.js in the public/assets directory did -- the ujs is included twice, so it fires twice. Via https://stackoverflow.com/a/9627690/604093


On Rails 5, rails-ujs replaces jquery_ujs. Events will trigger twice if both are required.

// app/assets/javascripts/application.js//= require jquery_ujs <-- delete this//= require rails-ujs


I am assuming that you are using jquery. This is usually happened when there is an incomplete call or there is some sort of error and you haven't refresh the page. Try something like this:

<script type="text/javascript">$('#new_product_group_form').submit(function() {                    $(this).unbind('submit').submit();       });</script>