Forum: Ruby on Rails Actions from radio_button_tag

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
39025a7f572d6fe464e1fe6be399ca3b?d=identicon&s=25 Mike Dershowitz (mdersh53)
on 2007-01-19 19:45
(Received via mailing list)

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!

39025a7f572d6fe464e1fe6be399ca3b?d=identicon&s=25 Mike Dershowitz (mdersh53)
on 2007-01-21 20:53
(Received via mailing list)

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 %>}"} %><br>

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 topic is locked and can not be replied to.