Skip to content

In IE, form with remote and confirm are submitted even when the user cancels #114

@raroni

Description

@raroni

As far as I can see, the current jquery-driver assumes that the form submit event is not fired if the input[type=submit]'s click event handler returns false.

In IE, this is not the case. This example illustrates it:

<form id="formx" action="flaf">
  <input id="submitx" type="submit">
</form>

<script type="text/javascript">
  $('form input[type=submit]').live('click', function(e) {
    alert('submit clicked!');
    return false;
  });

  $('form').live('submit', function() {
    alert('this is called for IE, not for Chrome/Firefox!');
  })
</script>

To make things even worse, IE is actually not submitting the form after calling the submit event handlers.

The result of this behavior is that forms with data-remote and data-confirm are always submitted in IE, even if the user clicks cancel in the confirm() dialog.

For instance, this will generate such a form.

<%= button_to 'text', 'path', :remote => true, :method => :put, :confirm => 'Sure?' %>

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions