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)
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 …
http://www.thoughtstoblog.com/articles/2006/10/27/observe_field-with-radio-buttonsWith 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
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