Rolando Abarca <funkaster@...> writes:
Bill Walton wrote: > Because the observer is a Rails helper method. It's 'mission' is to > generate the Ajax code for you. But it can only to that with objects it > 'knows about.' By choosing not to use the Rails select method, you > chose > not to let Rails know about the object you asked it to observe. You > might > as well have asked it to observe a <p>. Rails can only help you if you > let > it.
mmm... but the first parameter to the observer_field method is a DOM id... so I thought I could use any valid DOM id...
> hth, > Bill
regards, rolando.-
I had the same misconception that Rolando did -- I created my own checkbox field using HTML, with a unique name and id, and tried to use observe_field to observe it by referencing its id. I thought the first parameter to observe_field was the DOM id of the thing I wanted it to observe.
Instead I'm trying to use rails to generate the checkbox for me, but I'm still getting the "this.callback is not a function" error in my Javascript console:
<%= check_box_tag("private_check", :value => "1", :checked => true) %>Private <%= observe_field 'private_check', :frequency => 0, :update => "private_span", :url => {:action => 'mark_private', :only_path => false}, :with => "'p=' + escape(value)" %>
Any ideas what I'm doing wrong? Does the observe_field only work with real form elements and not ones created using the _tag methods?
Thanks, --Tessa