Jochen Daum wrote:
> Ok, managed to solve this.
>
> With the Ajax request, I did completely replace the <select> dropdown
> and mootools seems to clean up any events that are related to the
> element being replaced.
>   
That's not Moo specific - when the DOM object has been replaced, any 
associated event handlers will have gone to the bit bucket.

Just re-add the handler at the end of your function which changes the 
element.

It'll probably help to rearrange the code slightly, so you don't have to 
rewrite the entire function inside of itself, maybe something like this 
(untested):

var blah = {
  lumSelChange: function (){
                var x1 = new Ajax(
'/index.php?option=com_lightingcalculator&task=xml&type=la&id='+$('lum_sel').value+'&preset='+$('lam_sel').value,
                    {
                        method: 'get',
                        update: 'lamp_dropdown',
                        evalScripts: true
                    }
                ).request() ;
    // once the <select> node has been updated
    $('lum_sel').addEvent('change', blah.lumSelChange);   
  },
 
  lamSelChange: function() {
                  var x2 = new Ajax(
'/index.php?option=com_lightingcalculator&task=xml&type=lu&id='+$('lam_sel').value+'&preset='+$('lum_sel').value,
                    {
                        method: 'get',
                        update: 'luminaire_dropdown',
                        evalScripts: true
                    }
                ).request() ;
    // once the <select> node has been updated
    $('lam_sel').addEvent('change', blah.lamSelChange);   
  }
} ;

window.addEvent('domready', function() {
  $('lum_sel').addEvent('change', blah.lumSelChange);
  $('lam_sel').addEvent('change', blah.lamSelChange); 
});




--~--~---------~--~----~------------~-------~--~----~
NZ PHP Users Group: http://groups.google.com/group/nzphpug
To post, send email to [email protected]
To unsubscribe, send email to
[EMAIL PROTECTED]
-~----------~----~----~----~------~----~------~--~---

Reply via email to