Hi, > What I don't get is why the Drop Down change event fires only once,
I don't think that's not what's happening. Look again at your code setting up the observer: > function init() > { > Event.observe('categoryval', 'change', alert('you changed the > category drop down')); > > } If you look closely at it, what does that actually do? It executes an alert() (right then and there, not later when a change event fires), then passes the return value from the alert (undefined, I believe) as the handler function to use for the 'change' event. No handler gets set up. You want to wrap a function around that alert: function init() { Event.observe('categoryval', 'change', function() { alert('you changed the category drop down'); }); } Or even better (in many cases) have a named function that handles things: function handleCategoryChange() { alert('you changed the category drop down'); } function init() { Event.observe('categoryval', 'change', handleCategoryChange); } Both of those define (but do not execute) a function with the code to execute when the 'change' event fires, and pass that function reference into Event.observe, where it can be hooked up to the event. HTH, -- T.J. Crowder tj / crowder software / com On Sep 20, 8:25 pm, Newbee <[EMAIL PROTECTED]> wrote: > Hello, > > I'm new to Prototype development, and love the power it gives. > > What I don't get is why the Drop Down change event fires only once, > for a dynamically created Select Drop Down, in my example below (using > 1.5 of Prototype). > > Any thoughts on this would be greatly appreciated by a ruby / > prototype newbee :) > > Example: > > Index.rhtml > <html><head><script>... > > var categories = null; > > function buildDynamicDropDown() > { > > var url = 'dynaDropDown'; // returns <select id="categoryval" > name="categoryval"><option>... > new Ajax.Request(url,{ > method: 'get', > onSuccess: function(transport){ > categories = transport.responseText; > $('categoryval').replace(categories); > } > }); > > } > > function init() > { > Event.observe('categoryval', 'change', alert('you changed the > category drop down')); > > } > > <head> > <body> > <form ...> > <span> > <select id="categoryval" name="categoryval"> > <option value="1">Art</option> > <option value="6">Beauty</option> > </select> > </body></html> > > Thanks, > > Sjs --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---