# Events in view question

**URL:** <https://www.ruby-forum.com/t/events-in-view-question/108837>\
**Category:** Rails\
**Created:** [July 7, 2007, 10:58pm UTC](https://www.ruby-forum.com/t/events-in-view-question/108837 "2007-07-07T22:58:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ike](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/df705f/32.png) [@ike](https://www.ruby-forum.com/u/ike)\
**Post date:** [July 7, 2007, 10:58pm UTC](https://www.ruby-forum.com/t/events-in-view-question/108837/1 "2007-07-07T22:58:33Z")

</div>

I have taken an example wherein, using Ajax, the values of a second  
combobox are populated by a change in the primary combobox. The code  
is shown below.

I realise it will seem as though I am asking someone to write the code  
for me, BUT, can someone please show me, by way of an example how to  
amend my index.rhtml below to use, say a radio button group instead of  
a combobox, wherein when you change the radio button group, the  
secondary combobox is changed, without having to incorporate a submit  
button?

I somehow need someone to kickstart me here with this, and I can  
bootstrap the rest of what I am trying to do. Thanks. R. Vince

#in mycontroller:

def create\_select  
indArr=[“Nordic Skiing”, “Inline Skating”,“Tennis”,  
“Triathlon”,“Road Racing”,“Figure Skating”,  
“Weight Lifting”,“Speed Skating”,“Snowboarding”];  
teamArr=[“Soccer”,“Basketball”,“Football”,“Hockey”,  
“Baseball”,“Lacrosse”];  
str="";  
if params[:categories].index(‘Team’) != nil  
render :partial =\> “options”, :locals =\> { :sports =\>  
teamArr,:sptype =\> “team”}  
elsif params[:categories].index(‘Individual’) != nil  
render :partial =\> “options”, :locals =\> { :sports =\>  
indArr, :sptype =\> “individual” }  
else  
str="  
unknown";  
render :text =\> str;  
end  
end

#index.rhtml:

\<%= form\_remote\_tag(:update =\> “sel\_con”,:url =\> {  
:action =\> :create\_select },  
:position =\> “top”,:success =\> “$(‘sel\_con’).innerHTML=’’” ) %\>

Please select a sports category:

  

\<%= select\_tag “categories”,  
“TeamIndividual” %\>

  

  

\<%= submit\_tag “Show Sports” %\>

  
\<%= end\_form\_tag %\>

#\_options.rhtml:

 \<% sports.each do |sport| %\> \<%= sport %\> \<% end %\>
