Menu
function custom_menu(){
$items = array();
$items['custom/article'] = array(
'title' => t('Hello'),
'page callback' => 'article_load',
'access callback' => 'user_access',
'access arguments' => array('access user profiles'),
'type' => MENU_CALLBACK,
);
return $items;
}
Form
$form['article'] = array(
'#type' => 'textfield',
'#title' => t('Article Title'),
'#description' => t('Known article'),
'#default_value' => $form['_account']['#value']->article,
'#autocomplete_path' => 'custom/article',
);
function article_load($string = '') {
$matches = array();
if ($string) {
$result = db_query_range("SELECT nid, title FROM {node} WHERE LOWER(title) LIKE LOWER('%s%%')", $string, 0, 10);
while ($user = db_fetch_object($result)) {
$matches[$user->title] = check_plain($user->title);
}
}
drupal_json($matches);
}