*shakes fist at microsoft*

So click events bubble but submit events don't. That makes loads of
sense.

Given that, the delegation solution above won't work for forms, so in
that case is the only option to remove listeners prior to ajax loads
that'd overwrite the listeners' elements? If so, I suppose the best
thing to do is to store refs to the listeners in an array and
unregister them all prior to every ajax load.

Thanks for all the responses to my posts you've written over the last
month or so, btw.

On May 13, 12:41 am, "T.J. Crowder" <t...@crowdersoftware.com> wrote:
> Hi,
>
> The `submit` event doesn't bubble on IE[1] (and yes, it has been 10+
> years since the standard said it should[2]; what's your point? ;-) ),
> so you have to watch the form, not a container of the form, so your
> second script is your best bet and should work with IE *and* other
> browsers.
>
> [1]http://msdn.microsoft.com/en-us/library/aa769569(VS.85).aspx
> [2]http://www.w3.org/TR/DOM-Level-2-Events/events.html
>
> HTH,
> --
> T.J. Crowder
> Independent Software Consultant
> tj / crowder software / comwww.crowdersoftware.com
>
> On May 12, 9:11 pm, Junkshops <junksh...@gmail.com> wrote:
>
>
>
> > Hey guys,
>
> > Thanks for the advice. I made the suggested changes, but now I've got
> > a new problem - everything works fine in the good browsers, but, as
> > usual, doesn't work correctly in IE8. The difference is that in IE8,
> > instead of the output of the script replacing the contents of a div,
> > the script output replaces the entire page. IE8 works fine when the
> > listener is set directly on the form. Code for both situations is
> > below. Any advice? God I hate microsoft.
>
> > Thanks in advance.
>
> > ______________ IE 8 chokes. The sayThanks div is loaded along with the
> > form in an ajax load _____________________
>
> > function initContactListener() {
> >         $('centercontent').observe('submit', function(evt) { // will need
> > switch logic if another form added to the center content area
> >                 form = evt.findElement();
> >                 $('sayThanks').update('<div style="text-align:center"><img
> > src="images/ajax-loader.gif"></div>');
> >                 evt.stop();
> >                 new Ajax.Updater('sayThanks', form.action, {parameters:
> > form.serialize()});
> >         });
>
> > }
>
> > document.observe('dom:loaded', function() {
> >         initContactListener();
> >         /* removed unrelated code */
>
> > });
>
> > ________________ IE8 is ok - script is eval'd by prototype during an
> > ajax load of the form page __________________________
>
> > <script type="text/javascript">
> >         var formelement = $('contactForm');
> >         var sub = formelement.findFirstElement();
> >         sub.focus()
>
> >         formelement.observe('submit', function(evt) {
> >                 $('sayThanks').update('<div style="text-align:center"><img
> > src="images/ajax-loader.gif"></div>');
> >                 evt.stop();
> >                 new Ajax.Updater('sayThanks', this.action, {parameters:
> > this.serialize()});
> >         });
> > </script>
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "Prototype & script.aculo.us" group.
> > To post to this group, send email to 
> > prototype-scriptacul...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > prototype-scriptaculous+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/prototype-scriptaculous?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Prototype & script.aculo.us" group.
> To post to this group, send email to prototype-scriptacul...@googlegroups.com.
> To unsubscribe from this group, send email to 
> prototype-scriptaculous+unsubscr...@googlegroups.com.
> For more options, visit this group 
> athttp://groups.google.com/group/prototype-scriptaculous?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply via email to