I have a radio button that I would like to call two functions with an onclick: one is a js function the other a remote function Can this be done and what is the correct syntax? js function call ----------------------- <%= radio_button_tag ''save'',1, checked = true, :onclick => ''hide_div() '' %> remote_function ----------------------- <%= radio_button_tag ''save'',1, checked = true, :onclick =>remote_function(:update => "@mod", :url => { :action => :unsave, :id => @mod}) %> Tried ------------ <%= radio_button_tag ''save'',1, checked = true, :onclick => ''hide_div();remote_function(:update => "@mod", :url => { :action => :unsave, :id => @mod}) '' %> Doesn''t work, neither functions are called Thanks for you help - K --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
njmacinnes-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Feb-02 00:19 UTC
Re: Can you call multiple functions with onclick
Try this: <%= radio_button_tag ''save'',1, checked = true, :onclick =>''hide_div() '' + remote_function(:update => "@mod", :url => { :action => :unsave, :id => @mod}) %> Because ''hide_div()'' is a string and remote_function returns a string, there shouldn''t be a problem with that. -N On 01/02/07, Kim <Kim.Griggs-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > I have a radio button that I would like to call two functions with an > onclick: one is a js function the other a remote function > > Can this be done and what is the correct syntax? > > js function call > ----------------------- > <%= radio_button_tag ''save'',1, checked = true, :onclick => ''hide_div() > '' %> > > remote_function > ----------------------- > <%= radio_button_tag ''save'',1, checked = true, :onclick > =>remote_function(:update => "@mod", > :url => { :action => :unsave, :id => @mod}) %> > > Tried > ------------ > <%= radio_button_tag ''save'',1, checked = true, :onclick => > ''hide_div();remote_function(:update => "@mod", > :url => { :action => :unsave, :id => @mod}) '' %> > > Doesn''t work, neither functions are called > > Thanks for you help - K > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
njmacinnes-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Feb-02 00:21 UTC
Re: Can you call multiple functions with onclick
Sorry, that should, strictly speaking, be <%= radio_button_tag ''save'',1, checked = true, :onclick =>''hide_div(); '' + remote_function(:update => "@mod", :url => { :action => :unsave, :id => @mod}) %> (note the semi-colon) Most browsers would probably be able to handle the first one though. On 02/02/07, njmacinnes-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <njmacinnes-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Try this: > > <%= radio_button_tag ''save'',1, checked = true, :onclick > =>''hide_div() '' + remote_function(:update => "@mod", > :url => { :action => :unsave, :id => @mod}) %> > > Because ''hide_div()'' is a string and remote_function returns a string, > there shouldn''t be a problem with that. > > -N > > On 01/02/07, Kim <Kim.Griggs-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > I have a radio button that I would like to call two functions with an > > onclick: one is a js function the other a remote function > > > > Can this be done and what is the correct syntax? > > > > js function call > > ----------------------- > > <%= radio_button_tag ''save'',1, checked = true, :onclick => ''hide_div() > > '' %> > > > > remote_function > > ----------------------- > > <%= radio_button_tag ''save'',1, checked = true, :onclick > > =>remote_function(:update => "@mod", > > :url => { :action => :unsave, :id => @mod}) %> > > > > Tried > > ------------ > > <%= radio_button_tag ''save'',1, checked = true, :onclick => > > ''hide_div();remote_function(:update => "@mod", > > :url => { :action => :unsave, :id => @mod}) '' %> > > > > Doesn''t work, neither functions are called > > > > Thanks for you help - K > > > > > > > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
That Works! Thanks On 2/1/07, njmacinnes-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <njmacinnes-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Sorry, that should, strictly speaking, be > > <%= radio_button_tag ''save'',1, checked = true, :onclick > =>''hide_div(); '' + remote_function(:update => "@mod", > :url => { :action => :unsave, :id => @mod}) %> > > (note the semi-colon) Most browsers would probably be able to handle the > first one though. > > > > On 02/02/07, njmacinnes-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <njmacinnes-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > Try this: > > > > <%= radio_button_tag ''save'',1, checked = true, :onclick > > =>''hide_div() '' + remote_function(:update => "@mod", > > :url => { :action => :unsave, :id => @mod}) %> > > > > Because ''hide_div()'' is a string and remote_function returns a string, > > there shouldn''t be a problem with that. > > > > -N > > > > On 01/02/07, Kim <Kim.Griggs-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > I have a radio button that I would like to call two functions with an > > > onclick: one is a js function the other a remote function > > > > > > Can this be done and what is the correct syntax? > > > > > > js function call > > > ----------------------- > > > <%= radio_button_tag ''save'',1, checked = true, :onclick => ''hide_div() > > > '' %> > > > > > > remote_function > > > ----------------------- > > > <%= radio_button_tag ''save'',1, checked = true, :onclick > > > =>remote_function(:update => "@mod", > > > :url => { :action => :unsave, :id => @mod}) %> > > > > > > Tried > > > ------------ > > > <%= radio_button_tag ''save'',1, checked = true, :onclick => > > > ''hide_div();remote_function(:update => "@mod", > > > :url => { :action => :unsave, :id => @mod}) '' %> > > > > > > Doesn''t work, neither functions are called > > > > > > Thanks for you help - K > > > > > > > > > > > > > > > > > > > > >-- Kim Griggs kim.griggs-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org "We are all stakeholders in the Karma economy." --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---