ajax_example_autocomplete.inc

Demonstrates usage of the Form API's autocomplete features.

This file provides three examples in increasing complexity:

  • A simple username autocomplete (usernames are unique, so little effort is required)
  • A node title autocomplete (titles are not unique, so we have to find the nid and stash it in the field)
  • A username autocomplete that updates a node title autocomplete with a changed #autocomplete_path so that the #autocomplete_path can have context (the username to use in the search).

File

modules/examples/ajax_example/ajax_example_autocomplete.inc

Functions

Namesort descending Description
ajax_example_node_by_author_ajax_callback AJAX callback for author form element.
ajax_example_node_by_author_autocomplete Search by title and author.
ajax_example_node_by_author_autocomplete_submit Submit handler for node lookup unique autocomplete example.
ajax_example_node_by_author_autocomplete_validate Validate handler to convert our title string into a nid.
ajax_example_node_by_author_node_autocomplete_callback Autocomplete callback for nodes by title but limited by author.
ajax_example_simple_autocomplete A simple autocomplete form which just looks up usernames in the user table.
ajax_example_simple_user_autocomplete_callback This is just a copy of user_autocomplete().
ajax_example_unique_autocomplete An autocomplete form to look up nodes by title.
ajax_example_unique_autocomplete_submit Submit handler for node lookup unique autocomplete example.
ajax_example_unique_autocomplete_validate Node title validation handler.
ajax_example_unique_node_autocomplete_callback Autocomplete callback for nodes by title.