This project is archived and is in readonly mode.

#300 ✓invalid
Joe

"submit" event doesn't work in IE

Reported by Joe | August 6th, 2008 @ 03:35 PM | in 2.0 (closed)

It appears that the "submit" event for forms fails in Internet Explorer, which gives the error "Object doesn't support this property or method".

This works in Firefox and Opera, but not IE:

window.addEvent('domready', function() {
	$('myform').addEvent('submit', function(e) {
		e.stop();

		alert('Hi');
	});
});

I have asked on the IRC support channel but not got a solid answer.

Comments and changes to this ticket

  • Jan Kassens

    Jan Kassens August 9th, 2008 @ 09:23 AM

    • Assigned user changed from “Valerio” to “Jan Kassens”
  • David Walsh

    David Walsh August 14th, 2008 @ 06:49 PM

    This could be due to the fact that the submit buttons "name" or "id" attribute is "submit". I've run into this before on some non-Moo code.

  • Jan Kassens

    Jan Kassens August 14th, 2008 @ 07:40 PM

    • no changes were found...
  • Jan Kassens

    Jan Kassens August 14th, 2008 @ 07:40 PM

    • State changed from “new” to “invalid”

    works here (I've attaced a demo html), could be related to the (unfixable) but in IE David pointed out.

  • VirtuosiMedia

    VirtuosiMedia March 26th, 2009 @ 08:44 AM

    • Tag changed from 1.2release, events, ie to events, ie

    I've also had this problem for IE7, but I didn't have a submit button labeled or with the id or class of 'submit'. The only thing that had 'submit' was the type for the submit button. The particularly frustrating part is that I have another form that uses the exact same addEvent('submit') method on the same page and it works without giving any warnings or errors, but only when I commented out the problem form. The only way that I was able to work around it was to attach a click event to the submit button rather than a submit event to the form.

  • David Walsh

    David Walsh March 26th, 2009 @ 12:15 PM

    • Assigned user changed from “Jan Kassens” to “David Walsh”

    VirtuosiMedia - Do you have a test / example that we can look at?

  • DracoBlue

    DracoBlue July 2nd, 2009 @ 11:04 PM

    I guess he get's the message because of the e.stop().

    This:
    e = new Event(e);
    e.stop();

    Should fix the problem.

    I found this ticket, because I had an equivalent problem. The reason in my case was, that I accidently put a "submit"-event on a div, which contained the form. This actually worked in FF, Opera and Safari, but not in IE. Maybe somebody, who has exactly the same problem, will find that information useful ;).

    • Draco
  • Valerio

    Valerio July 3rd, 2009 @ 02:35 PM

    @DracoBlue: that's 1.11 code. In 1.2 Event is automatically instantiated.

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Shared Ticket Bins

Attachments

Tags

Referenced by

Pages