I found another way to make this work too. It turns out the solution was in
the LivePipe system, since it provides an "afterOpen" option to any object
you create, which is just like Prototype's "onComplete":

     57                         var w = new
Control.Modal(container,Object.extend({
     58                                 className: 'window_modal',
     59                                 closeOnClick: window_close,
     60                                 overlayOpacity: 0.75,
     61                                 fade: true,
     62                                 afterOpen: function(){
     63
Form.focusFirstElement($('signup_form'));
     64                                 }
     65                         },options || {}));


On Fri, Sep 5, 2008 at 8:19 AM, Diodeus <[EMAIL PROTECTED]> wrote:

>
> <form> Tags must be added to the DOM in order for you to attach events
> to them. Shoving them into innerHTML will not work.
>
> To get around this, you can either have <form> tag in the original
> document before the XHR request is called, then put the contents of
> the form   inside the existing <form> tag, or you can add the <form>
> tag dynamically using "new Element".
>
> On Sep 4, 11:07 pm, dustin <[EMAIL PROTECTED]> wrote:
> > I know this seems like a LivePipes question, but I'm really trying to
> > figure out how Prototype behaves here.
> >
> > I'm using the following line of code to create a modal dialog with a
> > signup form in it:
> >
> > <code>
> > var start_now_modal = new Control.Modal($('start_now_modal')
> > </code>
> >
> > The form that exists entirely in the inserted HTML (meaning the <form>
> > tag gets pulled in from an external file, presumably with some
> > underlying XHR request). Currently I have the this code at the very
> > end of the HTML that gets inserted: "<script>startNowModalLoaded()</
> > script>" to essentially simulate a "dom:loaded" event for my modal
> > box. I assume that when the new HTML gets inserted
> > startNowModalLoaded() is executed last and thus I can assume all my
> > new elements exist in the DOM.
> >
> > My goal is to use the "Form.focusFirstElement($('signup_form'))"
> > method, but it isn't working at all. If I attach that command to a
> > different event (other than load), like, onChange for one of the
> > dropdowns in my form, then things work as expected (i.e. when you
> > change the dropdown then the focus goes back to the first element of
> > the form).
> >
> > I assume that my attempt to get the initial focus working isn't
> > succeeding because the new content isn't fully loaded when I make my
> > call to Focus, but I'm not sure how else I can wait for things to
> > load. Hence my question: is there a "XHR content is done loading"
> > event that I can wait for, instead of just calling
> > startNowModalLoaded() at the end of my HTML?
> >
>

--~--~---------~--~----~------------~-------~--~----~
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-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to