Observe_field on focus

According to the Rails documentation, the following should pop an
alert on focus:

<%= observe_field :search_box, :function => “alert(value);”, :on
=> :focus %>

However, the alert still pop on changed. The generated prototype call
is:

new Form.Element.EventObserver(‘search_box’, function(element,
value) {alert(value);}, ‘focus’)

Looking at prototype.js 1.5.0, it does not seem to take the ‘focus’
parameter. Is observe_field broken? Or am I doing something wrong?

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