I agree this would be nice on the Periodical Observer, but I think what the initial reply was hinting at was this:
$('myform').observe('change', function(evt){ alert(evt.element().id); } ); Walter On Jun 10, 2008, at 2:40 PM, kangax wrote: > > I think this should be "fixed". Knowing which element was changed is > often crucial. I'll make a patch as soon as I get a chance. Meanwhile, > you can use this as a workaround: > > new Form.Observer($(form), 0.3, (function(){ > var previousValue = $(form).serialize(true), element; > return function(form, value) { > value = value.parseQuery(); > for (var prop in value) { > if (value[prop] !== previousValue[prop]) { > element = $(form).down('[name=' + prop +']'); > break; > } > } > previousValue = value; > // use "element" variable which references changed element > } > })()); > > Best, > kangax > > On Jun 10, 1:34 pm, louis w <[EMAIL PROTECTED]> wrote: >> Are you saying I need to assign a listener to each input field? >> >> On Jun 10, 12:02 pm, "Frederick Polgardy" <[EMAIL PROTECTED]> wrote: >> >>> Bubbling seems like the answer to me. Put any listeners you need >>> (change, >>> select, click, etc.) on the form element, and then in your >>> callback, use >>> event.element() to get the source element. From there you can >>> look at the >>> new value. >> >>> -Fred >> >>> On Tue, Jun 10, 2008 at 10:22 AM, louis w <[EMAIL PROTECTED]> >>> wrote: >>>> Should I assign a listener to each field? Should I try to get it to >>>> work with one listener and use bubbling? >> >>> -- >>> Science answers questions; philosophy questions answers. > > --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---