Aaron,

I can't say I fully understood your code but I tried all the ways I
could think of and still didn't get this to work. I'm quite sad about
this, maybe I'm missing something simple but can't see what it is...

On Sep 25, 9:42 pm, Aaron Newton <[email protected]> wrote:
> You should have a little more in that onSuccess method:
> first, you need to set evalScripts to false in the Request options, then
>
> handleResponse: function(response){
>  var responseScript = "";
> this.response.text.stripScripts(function(script){ responseScript += script;});
>
>  editVenueBox.set('html', responseHtml);
> $exec(responseScript);
>
> }
>
> 2009/9/25 Fábio M. Costa <[email protected]>
>
> > I understand it, i had passed thought it before.
> > The problem here is that the javascript is evaluated before the update is
> > done, so you dont have the popup on the DOM and cant addEvents to it. Theres
> > a way to do it, i dont like it but i'll show you as its the only i got.
>
> > var editVenueBox = $('edit_venue_box');
> > new Request.HTML({
> >   url: '/admin/venue/' + venue_id,
> >   evalScripts: false,
> >   onSuccess: function(responseTree, responseElements, responseHtml,
> > responseJs){
> >     editVenueBox.set('html', responseHtml);
> >     $exec(responseJs);
> >   }
> > }).send();
>
> > Did you get it? Still i dont know why its done like this, shouldn't the
> > order be changed (to the core-devs)?
>
> > --
> > Fábio Miranda Costa
> > Solucione Sistemas
> > Engenheiro de interface
>
> > On Fri, Sep 25, 2009 at 3:06 PM, Pedro Moreira 
> > <[email protected]>wrote:
>
> >> Hello everyone,
>
> >> I've been working on a really fun project but today something got on
> >> my nerves. I searched for some solutions but none worked for me. I
> >> even found one post somewhere with something similar:
> >>http://www.mooforum.net/general12/domready-after-request-html-t1743.html
>
> >> So... There's a page with a bunch of rows on a table and each row as a
> >> link "edit". On that page I add an event to each link when the user
> >> clicks on it. This event makes a Request.HTML and the html response
> >> will be set by the update option on a lightbox-like div, a better
> >> looking pop up window. On this new page I have some input fields and
> >> an input button which I want to be able to click to trigger an event
> >> (a request to save the input fields).
>
> >> Problem is: I can't add events on the pop up window!
>
> >> Code-wise:
> >> page.php
> >> ...
> >>            window.addEvent('domready', function()
> >>            {
> >>                ...
>
> >>                $each($$('a.edit_venue_link'), function(item)
> >>                {
> >>                    item.addEvent('click', function()
> >>                    {
> >>                        var venue_id = item.get('venue_id');
>
> >>                        new Request.HTML(
> >>                        {
> >>                            url: '/admin/venue/' + venue_id,
> >>                            update: 'edit_venue_box'
> >>                        }).send();
> >>                    }
> >>                    );
> >>                }
> >>                );
> >> ...
>
> >> /admin/view/:num (it's a controller which triggers a view with...)
> >> ...
> >> <script>
>
> >>    window.addEvent('domready', function()
> >>    {
> >>        alert($('submit_button').get('text'));
>
> >>        $('submit_button').addEvent('click', function()
> >>        {
> >>            alert('is it working?');
> >>        });
> >> ...
>
> >> The alert with the submit_button text works but all the events I try
> >> to add don't.
>
> >> Am I doing something wrong?
>
> >> I tried setting evalScripts true and false but it still doesn't work.
> >> The solution on the link I wrote about doesn't work either...

Reply via email to