field_observer :on


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 => ‘“foobar”)’ %>

here’s some background:


[]( (discusses "blur")

[]( (specific to "focus")

[]( (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…