Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

unobtrusive js: form_for :remote => true doesn't work in IE

#5009

I've been working with Rails 3 beta 4 for a while on the Mac, then I switched to my PC laptop to test the site out. In IE (6,7, and 8), all the Ajax forms stopped working (it got me freak out a bit). After debugging the code for a while, it turned out that the even with the :remote => true option, IE just does not support event bubbling for the submit event. The comment in rails.js (around line 93) is

// TODO: I don't think submit bubbles in IE
$(document.body).observe("submit", function(event) {...

With :remote => true doesn't work in IE, this is a huge issue and I don't think Rails can be shipped without this feature fully working.

My thinking is that specifically for the "forms_for :remote => true", the onSubmit event of the form need to explicitly call the handleRemote() method in the rails.js file so that the event can be captured, processed, and stopped appropriately. It's not a very "unobtrusive" solution, but I don't see away to work around this issue. My knowledge of Rails internal stuff is not that great yet, but I will take a look into the actionpack code to see if I can find a work around.

Is there anyone who's also looking into this issue?

Reported by Alex Le · June 30th, 2010 @ 01:33 AM

State: resolved
Milestone: none
Assigned to: nobody
Importance: Low

Activity

  1. Alex Le
    Alex Le

    Looking into latest code on github, the latest version of rails.js actually containing the fix that makes :remote => true on IE works.

    The commit is http://github.com/rails/rails/commit/f61d923d284062b4e4864d81c60315...

    http://github.com/rails/rails/raw/master/railties/lib/rails/generat...

    I have verified this to work in IE8 and 7.

    June 30th, 2010 @ 01:42 AM

  2. Rohit Arondekar
    Rohit Arondekar
    • State changed from new to resolved
    • Importance changed from to Low

    July 1st, 2010 @ 07:44 AM

  3. bingbing