Search code examples
javascriptruby-on-railsinternet-explorer-9ujs

Rails 3.0 :remote => true with ie9 will double submit form when I click on submit button


I have a Rails 3.0 app which is using a normal :remote => true option for a form_for. It works correctly in all browsers except IE9. Even IE8 works ok. But in IE9, I can see by using the F12 developer tool that it is issuing 2 requests to the server when I click the submit button.

Here's the form_for:

<%= form_for @project, :project, :url => create_project_url, :remote => true do |f| %>

Here's the submit button:

<%= submit_tag 'Create' %>

Looking at the F12 information it shows 1 request initiated by "JS Library XMLHttpRequest" and one initiated by "click".

Does anyone have an idea how to prevent this?


Solution

  • I found the solution to my problem. Upgrading my prototype.js and rails.js files to the latest did the trick. Upgrading the prototype.js file was the most important, but I did the rails.js one just to make sure.

    Here's a link to the latest prototype.js download: http://www.prototypejs.org/download