I want to make a search field for a form that automatically refreshes the form as you type with the answers that match the filter, like google does it.

I looked at https://api.drupal.org/api/drupal/includes!ajax.inc/group/ajax/7 and the examples module for the ajax related stuff but I can't find all the possible ajax events listed. The only ones I know of are blur, keydown and keyup.

I thought keyup would do the trick but every time I type a letter in the textfield the ajax event will disable the textfield, only to let me type another letter after the ajax callback is finished. I can't use this.

I want something like the autocomplete Drupal incorporates, it doesn't block the textfield at every typed letter, but as far as I know the native autocomplete uses a combination of ajax events.

Can someone please give me an idea of how I can accomplish such a task?

Edit: Just to be clear, I'm not looking to autocomplete suggestions, I know how to do that, I want to update a paged table of results with each letter typed.

1 Answer 1


Take a look at Drupal Instant Search, or Finder. Even if it isn't exactly what you want, it should be a good starting point.

Drupal Instant Search:

It works as follows: The url for the instant is at /instant The user types his search word, once he finishes typing (javascript keyup) the module automatically submits the search word and returns the search results. The search results are displayed at the same page of the instant search.

Instant search is also integrated with Top searches module. if Top searches module exists, the instant search auto-completes top search words.



This module is unsupported due to a security issue the maintainer didn’t fix.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.