Jaroslaw Z. wrote:
Just worked through some issues with this myself so…
<%= radio_button_tag(:city, ‘Dublin’) %>
<%= observe_field(:citi, :frequency => 0.5,
Two things here:
The first parameter to observe_field is the id of the field you’re
observing. In your case the line should start
<%= observe_field(‘city’ …
I’m not sure if a symbol will work. If it does, great. If not, go to a
quoted string in both the radio_button_tag and observe_field statements.
The default for radio_button is onchange so, unless you’ve some other
for wanting to monitor it, you don’t need the :frequency setting.
:on => 'click',
Again, the default is for a radio_button is ‘onchange’. You don’t need
:with => "'city=' + $F('citi')",
The explanation in the documentation for the :with option is, IMHO,
incomprehensible. That’s probably because you can do more complicated
with it than most folks want/need to do. What :with does, in cases like
yours, is allow you to name the param in which the value in the field
observing will come back. So to get the value in the controller with
params[:city], all you need is :with => ‘city’.