I guess I thought it would work because the returned HTML is identical
to what was 'posted' (with the addition of an extra list item)
including the form and surrounding div's

This is all I am returning (after the HTML) from the Ajax response:

<script type="text/javascript">
        Event.observe('frmAddLink', 'submit', submitForm);
</script>



On Jan 24, 9:13 am, "Justin Perkins" <[EMAIL PROTECTED]> wrote:
> On Jan 23, 2008 4:00 PM, Michael Sharman <[EMAIL PROTECTED]> wrote:
>
> > So if I fire an ajax form submission (and the same form is returned in
> > that ajax response), then attempt to fire it again (without reload the
> > entire page) it seems to fail.
>
> > It only works in that scenario when I have the dom:loaded observer
> > under the form code (which is also returned in the ajax response)
>
> Well yes. When you do that you are ripping DOM elements out of the
> page. At this point your DOM listeners are still attached to these
> orphaned elements, waiting in vain for an event to occur.
>
> You need to run through your event registration code on any new
> elements. Embedding a dom:loaded listener in an Ajax response is not
> something I would ever do, I just tack on a call to my event
> registration method either at the end of the response or in the
> onSuccess handler for the Ajax request.
>
> -justin
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to