Hi, I want to give suggestions(basically showing a hidden div) when somebody clicks on the text box to write(I assumed this is what on:focus meant). <%= observe_field :test_field, :function => "alert(''Element on focus'')", :on => :focus %> But surpisingly, alert is called when the value is changed and focus moves onto something else.. Can somebody suggest? how to get this working? Regards, Sandeep G -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
<%= text_area ''test'', ''field'', "cols" => 60, "rows" => 4 , :onclick => "$(''tips'').show();", :onBlur => "$(''tips'').hide();" %> This did the trick; :) Sandeep Gudibanda wrote:> Hi, > > I want to give suggestions(basically showing a hidden div) when somebody > clicks on the text box to write(I assumed this is what on:focus meant). > > <%= observe_field :test_field, :function => "alert(''Element on focus'')", > :on => :focus %> > > But surpisingly, alert is called when the value is changed and focus > moves onto something else.. > > Can somebody suggest? how to get this working? > > Regards, > Sandeep G-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
>> >> <%= observe_field :test_field, :function => "alert(''Element on focus'')", >> :on => :focus %> >>observe_field is used to check whether any changes made to the particular field.. Once u did any change in this particular field that alert was called. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Ratnavel Sundaramurthi wrote:> >>> >>> <%= observe_field :test_field, :function => "alert(''Element on focus'')", >>> :on => :focus %> >>> > > > observe_field is used to check whether any changes made to the > particular field.. > Once u did any change in this particular field that alert was called.I understand the on: options it to have control over the events like focus, click, change, blur and such... It is just that the code in prototype is forcing the default change irrelevant to :on option that we choose. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---