function ajax_example_simple_autocomplete
A simple autocomplete form which just looks up usernames in the user table.
Parameters
array $form: Form API form.
array $form_state: Form API form.
Return value
array Form array.
1 string reference to 'ajax_example_simple_autocomplete'
- ajax_example_menu in ajax_example/
ajax_example.module - Implements hook_menu().
File
-
ajax_example/
ajax_example_autocomplete.inc, line 29
Code
function ajax_example_simple_autocomplete($form, &$form_state) {
$form['info'] = array(
'#markup' => '<div>' . t("This example does a simplest possible autocomplete by username. You'll need a few users on your system for it to make sense.") . '</div>',
);
$form['user'] = array(
'#type' => 'textfield',
'#title' => t('Choose a user (or a people, depending on your usage preference)'),
// The autocomplete path is provided in hook_menu in ajax_example.module.
'#autocomplete_path' => 'examples/ajax_example/simple_user_autocomplete_callback',
);
return $form;
}