Autocomplete Form

In Zeiten des Web 2.0 sind ajax Features immer populärer und damit wichtiger. Ein wichtiges Element dabei ist die Autovervollständigung von Formularfeldern.
Dafür bietet Drupal einen richtig schönen Automatismus: #autocomplete_path im Formelement

$form['extra'] = array(
'#type' => 'textfield',
'#title' => 'extra',
'#default_value' => $node->extra,
'#required' => false,
'#autocomplete_path' => 'todo/js'
);
?>

Somit wird der Pfad 'todo/js' aufgerufen

Dieser muss mit der menuapi hinterlegt sein also 'todo_js', 'access callback' => 'user_access', 'access arguments' => array('access content'), 'type' => MENU_CALLBACK, ); return $items; } ?> Nun wird das Menuelement 'todo/js' aufgerufen: Dieses hat die Funktion todo_js hinterlegt $date)); } ?> Das gibt z.B. das aktuelle Datum aus. Man könnte aber auch Views usw. hinterlegen Hir das Video wie es dann aussieht

Add new comment