Hey everybody, I am trying to create a button that, when clicked on, calls a method in a controller then changes the image on the button without a page load. I was thinking that button_to_function might be a good contender for this but I don''t yet know how to make it talk to a controller, and on success change the image of the button. Can anyone help me out with this problem? Thanks, John --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Jables wrote:> Hey everybody, > I am trying to create a button that, when clicked on, calls a method > in a controller then changes the image on the button without a page > load. I was thinking that button_to_function might be a good > contender for this but I don''t yet know how to make it talk to a > controller, and on success change the image of the button. Can anyone > help me out with this problem? > > Thanks, > JohnIf you need to talk to controller, then it will load the page right? Just put some helper method and call it in the button_to_function. Iam not sure. -- 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 -~----------~----~----~----~------~----~------~--~---
On Dec 4, 8:33 am, Ayyanar Aswathaman <rails-mailing-l...@andreas- s.net> wrote:> Jables wrote: > > Hey everybody, > > I am trying to create a button that, when clicked on, calls a method > > in a controller then changes the image on the button without a page > > load. I was thinking that button_to_function might be a good > > contender for this but I don''t yet know how to make it talk to a > > controller, and on success change the image of the button. Can anyone > > help me out with this problem?button_to_function ''Click me'', remote_function(:url=>{:action => ''foo'', :controller => ''bar''}} remote_function takes basically the same options as link_to_remote and generates the javascript for an ajax call. You''ll want to read about rjs for the final step of your problem Fred --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---