28th November 2005 · Last updated: 5th October 2016
<input> element, but the form had another function call that occured on submit. D'oh!
It occured to me that since the code did work in Opera, Explorer was perhaps acting on the two clashing function calls in a different order. So I devised a test. The results are interesting in that Explorer seems to be the less capable browser when it comes to
onmouseup. I've abandoned using that action before, due to problems in Explorer. In my test it actually stops the form from being submitted! Here is the test:
I'd like to leave you with a summary of what I am getting on Windows XP. Your results may differ. If so, let me know.
|Opera 8.51||Occurs last, after onsubmit||Occurs first, then onsubmit|
|Firefox 1.5 RC3||Occurs first, then onsubmit||Occurs first, then onsubmit|
|Internet Explorer 6 & 7||Occurs, but onsubmit doesn't!||Occurs first, then onsubmit|
Comments are locked on this topic. Thanks to everyone who posted a comment.
- Nick Fitzsimons:
Ah, another IE event peculiarity! I've been bitten a number of times by IE's strange ideas about event sequences - for example, IE 4 had a very odd sequence of blur/focus events when focusing form fields in different frames.
For the purpose you describe, I would have probably have disabled the Submit button in the onsubmit handler, as there is a logical connection between the reason for disabling the button and the act of submitting the form. Using mousedown/mouseup events on the button could lead to unexpected effects if, say, the user pressed the mouse button on another element or a link, decided they didn't want to click on it after all, moved the mouse away (so as to cancel the click action on that element, but such that the pointer happened to be over the submit button) and then released the button again; I believe the button would then receive the mouseup event, even though the user had made no attempt to submit the form.
Thanks for another post that I'll remember after driving myself mad debugging the selfsame problem in a few months
Posted on 17 January 2006 at 7:45 pm ¶