# Actions from radio\_button\_tag

**URL:** <https://www.ruby-forum.com/t/actions-from-radio-button-tag/82697>\
**Category:** Rails\
**Created:** [January 19, 2007, 7:45pm UTC](https://www.ruby-forum.com/t/actions-from-radio-button-tag/82697 "2007-01-19T19:45:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![miked](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ed655f/32.png) [@miked](https://www.ruby-forum.com/u/miked)\
**Post date:** [January 19, 2007, 7:45pm UTC](https://www.ruby-forum.com/t/actions-from-radio-button-tag/82697/1 "2007-01-19T19:45:38Z")

</div>

Hi:

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

RJS:  
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!

Mike

---

<div class="post-metadata">

**Author:** ![miked](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ed655f/32.png) [@miked](https://www.ruby-forum.com/u/miked)\
**Post date:** [January 21, 2007, 8:53pm UTC](https://www.ruby-forum.com/t/actions-from-radio-button-tag/82697/2 "2007-01-21T20:53:47Z")

</div>

Hi:

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!

Mike
