select list and observe_field problem

Hey all,

I have attached an observe_field to a select box in one of my views in order to trigger a function when the user selects a new item.
The problem is that I can not seem to be able to convince it by any means to call the function *only* when a new item is really chosen (and not just hovering over it).

I have tried to hook on every kind of event with the :on => 'blabla' option, but no matter what I have used, the function is called also when I am hovering over an item but not actually selecting it. Is it possible to achieve this at all? (I am sure it is but I am a bit frustrated after all this googling around :frowning:

Any ideas? Thanks a million.

Cheers,
Peter

yes, it's the :on option. From the docs:

:on
Specifies which event handler to observe. By default, it's set to
"changed" for text fields and areas and "click" for radio buttons and
checkboxes. With this, you can specify it instead to be "blur" or
"focus" or any other event.

so it would be observe_field :field_id, :on => 'change'

Peter Szinek wrote:

William Pratt wrote:

yes, it's the :on option. From the docs:

:on
Specifies which event handler to observe. By default, it's set to "changed" for text fields and areas and "click" for radio buttons and checkboxes. With this, you can specify it instead to be "blur" or "focus" or any other event.

so it would be observe_field :field_id, :on => 'change'

of course, I have tried that, and also other events, but nothing worked. It still triggers on hovering, too (also with :on => 'change' or :on => 'click')...

Cheers,
Peter

I am using it in my app on a few occasions for pagination, etc and it
is working well. Have you validated your markup?

Peter Szinek wrote: