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?