Field_observer :on

Hi,
I need a prototype/javascript guru to take a peek at this.

There’s been discussions about prototype.js missing full support for
the :on parameter to field_observer
eg this is ignored, and always defaults to on “change”, whether you
use “focus”, “keyup” , “blur” whatever

<%= observe_field ‘foo’, :on => “focus”, :function => ‘Element.show
(“foobar”)’ %>

here’s some background:
http://dev.rubyonrails.org/ticket/9003
http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/
b297e6e10c1989fc?hl=en (discusses “blur”)
http://jonathan.tron.name/articles/2006/07/21/working-on-forms-with-
prototype (specific to “focus”)
http://joshhuckabee.com/rails-observe-field-function-and (general
solution)

The joshhuckabee article seems the best generalized solution, gives a
patch to prototype.js

but seems out of date w/r/t Rails 2.0 prototype.js When I add the
patch, FireBug goes into an infinite loop adding errors:

Form.Element.getValue is not a function
return Form.Element.getValue(this.element);

It’s probably a simple fix to get it to work again. But I dont know
js that well…

tia

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs