dekhaus-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Jan-09 18:55 UTC
observe_field(s) on a set of radio_button
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-buttons
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
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</p>
<p><%= radio_button :lineup, :choice, "sat", :id =>
"sat_id" %>
Satellite</p>
<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''
%>
[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
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---