Adding custom callbacks to auto_complete_field?

Hi guys,

I was wondering if I can add a custom callback to ‘auto_complete_field’

I know there are several options (:on_show, :on_hide, :after_update, and
so on) already, but I want to add another callback, which will be
triggered every time an action bound to ‘auto_complete_field’ is

The reason why I want this callback is that I want to show the number of
hits. I’m using ‘:on_show’ option for this purpose by counting

  • elements in query results at the moment. However, it doesn’t work when
    there is no hit or you just refine your query string without leaving
    the text field.

    Any help would be appreciated.