Bug Tracker

Opened 14 years ago

Closed 13 years ago

#5722 closed bug (invalid)

return false on live submit doesn't prevent normal browser submit

Reported by: s.baronnet Owned by:
Priority: critical Milestone: 1.4
Component: event Version: 1.4a2
Keywords: Cc:
Blocked by: Blocking:

Description

        $("form").live('submit',function()
        {
            return false;
        });

the return false doesn't prevent normal browser submit

Attachments (1)

ticket5722.html (731 bytes) - added by s.baronnet 14 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 Changed 14 years ago by dmethvin

Can you attach a complete test case? I think this may be a duplicate of #5705, the reporter there said it only happened on IE.

Changed 14 years ago by s.baronnet

Attachment: ticket5722.html added

comment:2 Changed 14 years ago by s.baronnet

  • The problem is only with live binding
  • a normal submit button works correctly
  • a submit with an onclick="$('form').submit()" will not work correctly

see the test case attached

comment:3 Changed 14 years ago by s.baronnet

I tested with firefox 3.5.6

comment:4 Changed 14 years ago by iraebrasil

I dug into this problem. I noticed that the problem is not in .live() but the triggering of .submit() itself. After much debugging it seamed to me that was a browser problem. That's when I found this: https://developer.mozilla.org/en/DOM/form.submit

"Event handling markup like onsubmit="return false;" will not be evaluated when calling the submit method from code. The above code snippet will try and cancel the submit event which will not work when calling the submit method from code."

So it's not a jQuery fault. It's normal browser behavior. Therefore I think this bug is invalid and should be closed.

comment:5 Changed 13 years ago by dmethvin

Component: unfiledevent
Resolution: invalid
Status: newclosed
Note: See TracTickets for help on using tickets.