Prototype does have something called Form.Element.EventObserver, but
it appears to have no documentation whatsoever, even in the current
1.6.1 source code (documentation is being migrated to being inline
with the source code and then generated as part of the build process).

Looking at the code, all it does is watch for the relevant event
('click' on checkboxes or radio buttons, 'change' on everything else;
if you use it to watch a form element, it watches every form element
within the form) and the fire an event if the control's value changed
when the event happened.  So, it doesn't do much on top of the
straight Element#observe Rick pointed out, although it does provide
that "don't tell me unless something really changed" feature, and if
you use it you don't have to remember which event to watch on which

There's also Form.Element.Observer, which watches an element with a
timer and fires an event whenever the value of the control changes.
This is handy in some situations because the 'change' event of many
controls doesn't fire until the focus leaves the control.  Not sure
whether it would be useful for what you're doing or not; you could end
up re-populating the control a lot as the user navigates through the
choices in the select box.  The documentation for it is very well
hidden at the bottom of this page:

T.J. Crowder
tj / crowder software / com
Independent Software Engineer, consulting services available

On Jul 10, 11:37 pm, Rick Waldron <waldron.r...@gmail.com> wrote:
> $('id-of-form-element').observe('change', function () {// do stuff in here.
> });
> On Fri, Jul 10, 2009 at 3:33 PM, Mathew <math...@gmail.com> wrote:
> > I don't see Form.Element.EventObserver in the API doc. Is it
> > deprecated ? If not could someone provide an example of using this
> > API.
> > Basically the requirement is, if the drop-down list changes its value
> > dy$()namically,  or re-populated dynamically then i need to invoke a
> > method to populate another form control (another drop-down)
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 
For more options, visit this group at 

Reply via email to