Observing Radio Buttons?

Observing Radio buttons

I am having some thing like the following code:
// Radio Button with id new_X
New X

// Observe method on radio button
// test_X method exists in the controller and has a correspondin rhtml
file.
<% observe_field(:new_ X, :frequency => 0.1,
:update => :new_X _container,
:url => { :action => :test_X })
%>

// Container to change on clicking the radio button.

Can you please help me as why this does not work ?

Thanks
Nitin.

Hi Nitin,

Nitin wrote:

                :url => { :action => :test_X })

%>

Because you’ve hand-coded the field you’re asking Rails to observe.
Rails
is server-side technology that generates the html and/or js to send to
the
browser. But it only concerns itself with the stuff you tell it you
want it
to concern itself with. You tell it that by using erb (embedded ruby)
in
your view files. Any html you hand-code just gets passed straight
through
to the browser. So in the case of your observe_field, Rails has no
knowledge of the form element you’re asking it to generate js to
observe.
It’ll get worse if you’ve hand-coded the form tags too.

If you’re new to Rails, especially if you’re coming from something like
PHP,
you’d really benefit from working through a tutorial or two to get the
hang
of how things work together. At the risk of self-promotion, we just did
a
rewrite of Curt Hibb’s “Rolling with Ruby on Rails” tutorial to bring it
up
to date with current (or at least near current) syntax / practices.
It’s
at:

I hope you find it helpful. And welcome to Rails!

Best regards,
Bill