Forum: Ruby on Rails observe_field(s) on a set of radio_button

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.
34d8d8d89bd63144e3616417f2c41d4b?d=identicon&s=25 unknown (Guest)
on 2007-01-09 20:16
(Received via mailing list)
Hi All

  I have a form in which there are ...

- a text entry
- a set of radio buttons
- a select (menu drop down thing)

  When one of the radio button is selected the 'select / menu drop down'
is updated.   I'm using an 'observe_field' - one for each radio_button.
  Everything is working fine - except it only works for one selection
per radio button.  Once a specific radio button has been selected - the
'ajax updating' of the 'select / menu drop down' stops working as a
result of the method in the control not being called.

  There is a succinct description of the problem - here ....

        With respect to the 'thoughtstoblog' post - I don't understand
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.

       Any help/tips/pointers/references would be greatly appreciated


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


    Select your service type:
    <p><%= radio_button :lineup, :choice, "cab", :id => "cab_id" %>
    <p><%= radio_button :lineup, :choice, "sat", :id => "sat_id" %>
    <p><%= radio_button :lineup, :choice, "ant", :id => "ant_id" %>
Rabbit Ears</p>
    <%= 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'

  def getprovider

    @service = params[:selectedlineup]

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

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

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

    render(:layout => false)
This topic is locked and can not be replied to.