# Observe\_field(s) on a set of radio\_button

**URL:** <https://www.ruby-forum.com/t/observe-field-s-on-a-set-of-radio-button/81545>\
**Category:** Rails\
**Created:** [January 9, 2007, 8:16pm UTC](https://www.ruby-forum.com/t/observe-field-s-on-a-set-of-radio-button/81545 "2007-01-09T20:16:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [January 9, 2007, 8:16pm UTC](https://www.ruby-forum.com/t/observe-field-s-on-a-set-of-radio-button/81545/1 "2007-01-09T20:16:30Z")

</div>

Hi All

I have a form in which there are …

- a text entry

- a set of radio buttons  
and

- a select (menu drop down thing)

what is being proposed as solution .

```
    I've also seen some references to workarounds on this listserv

```

- but to be honest, I’m a bit confused as to what exactly is being  
proposed. If its not already obvious - I’m new to Rails.

Thanks  
Dave

p.s. For the sake of completeness - here are some code snippets.

Note: FWIW -adding ':on =\> ‘click’ as an option to ‘observe\_field’  
doesn’t help

[view]

```
Select your service type:
<p><%= radio_button :lineup, :choice, "cab", :id => "cab_id" %>

```

Cable

  

\<%= radio\_button :lineup, :choice, “sat”, :id =\> “sat\_id” %\>  
Satellite

  

\<%= radio\_button :lineup, :choice, “ant”, :id =\> “ant\_id” %\>  
Rabbit Ears

  
\<%= observe\_field ‘cab\_id’,  
:update =\> “ajaxWrapper”,  
:url =\> {:action =\> ‘getprovider’},  
:with =\> ‘selectedlineup’  
%\>

```
<%= observe_field 'sat_id',
                :update => "ajaxWrapper",
    :url => {:action => 'getprovider'},
    :with => 'selectedlineup'
%>

<%= observe_field 'ant_id',
                :update => "ajaxWrapper",
    :url => {:action => 'getprovider'},
    :with => 'selectedlineup'
%>

```

[controller]

def getprovider

```
@service = params[:selectedlineup]

if @service == 'cab'
  @providers = ['cable lineups']
end

if @service == 'sat'
  @providers = ['satellite lineups']
end

if @service == 'ant'
  @providers = ['antenna lineups']
end

render(:layout => false)

```

end
