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