Can you call multiple functions with onclick

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()
’ %>


<%= radio_button_tag ‘save’,1, checked = true, :onclick
=>remote_function(:update => “@mod”,
:url => { :action => :unsave, :id => @mod}) %>


<%= 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

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,
shouldn’t be a problem with that.


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.

That Works! Thanks

On 2/1/07, [email protected] [email protected] wrote:

there shouldn’t be a problem with that.

Kim G.
[email protected]

“We are all stakeholders in the Karma economy.”

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs