Actions from radio_button_tag


I have a radio_button_tag I’d like to catch the “onclick” action for as
you would in HTML. When this happens, there is a simple DIV tag that I
want to appear (probably through my RJS and “form_remote_tag”. I’m a
bit of a newbie and getting lost in this. here’s what I have:

from view:
<% form_remote_tag :url => { :action => :goaltype } do %>
<%= radio_button_tag “one-time”, “one-time goal”, checked = false %>
<% end %>

page.replace_html(“onetime” , :partial => “g_onetime”)

Partial to appear when radio button is clicked is just another form :

My controller method “goaltype” is empty because there’s nothing I
really need to do, or do I?

Thanks so much in advance for your help!



I’ve changed this now going to a simpler example, but it’s still not
working - I can’t catch the onclick in the radio button:

<%= radio_button_tag “one-time”, 1, checked = false, options =
{:onclick => “#{<%= link_to_function(“One-Time Goal”, nil, :id =>
“onetime”) do |page|
page.replace_html(“goaltype” , :partial => “g_onetime”, :object =>
f) end %>}”} %>

Now I’m getting a syntax error.

This seems like the best way to do this but i’m getting tripped up
becuase of syntax.

Thanks so much in advance!


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