Call rails method from onclick?

I’d like to have the onclick of a form element call a rails method.
Such as:

radio_button :model, :method, ‘onclick’ => :railsMethod

Otherwise, I’m going to have to do this outside the rails
framework…the old fashioned way hehe.

(I can’t get various rjs, observe_field, observe_form, etc attempts to
work…if you’d like to take a stab go right ahead:

krunk- wrote:


You can look at remote_function
Quoted from the RDoc

<select id=“options” onchange=“<%= remote_function(:update => “options”,
:url => { :action => :update_options }) %>”>

Hello World

Hope this helps


Gustav P.
[email protected]

krunk- wrote:

radio_button :model, :method, ‘onclick’ => :railsMethod

What about

radio_button :model, :method, :onclick =>
remote_function(:controller => ‘some’, :action => ‘action’)


Thanks alot! Just what the doctor ordered