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 :( Any ideas? Thanks a million. Cheers, Peter __ http://www.rubyrailways.com http://scrubyt.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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:> 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 :( > > Any ideas? Thanks a million. > > Cheers, > Peter > > __ > http://www.rubyrailways.com > http://scrubyt.org > > > >-- Sincerely, William Pratt --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 __ http://www.rubyrailways.com http://scrubyt.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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:> 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 > __ > http://www.rubyrailways.com > http://scrubyt.org > > > >-- Sincerely, William Pratt --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---