Handler receives null event object for remote form submit on IE #222

symve opened this Issue Nov 17, 2011 · 2 comments

2 participants


On IE8 at least, the following does not work. (Using rails.js of November 07, 2011, and jQuery 1.6.2)

  1. Load the HTML below into IE8
  2. Open the developer tools (F12) and switch to the log console on the scripts subtab
  3. Press the Submit button

Here's the console output that is generated. Note the submit event is received twice: first with event == null and second with a valid event object.

LOG: submit form; event = null
ERR: 'null' is null or not an object
LOG: submit form, event = [object Object]

Removing the rails.js include or the data-remote attribute on the form makes it all work again. As expected the handler is only called once, and the event object actually exists.

<!DOCTYPE html>
    <title>Rails.js Bug Demo</title>

    <form action="/submit/path" data-remote="true">
      <input type="submit">

    <script src="./jquery.min.js"></script>
    <script src="./rails.js"></script>
      $('form').submit(function (event) {
        console.log('submit form, event = ' + event);
        event.preventDefault();   // Will cause error because event == null.
        return false;   // To prevent moving away from this page.
Ruby on Rails member

Awesome, thanks for the report. I know exactly what's causing this. I'll get it fixed asap.

Ruby on Rails member

Fix is in new release 1.0.18.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment