By AgaPe on
I have a select field which i want to change to automplete. Somehow i can use the autocomplete solution from node_reference module, and it works but can't make my own.
So the fields with
['#autocomplete_path'] = 'node_reference/autocomplete/node/field_media_from_reference';
change to autocomplete fielld
but mine with
['#autocomplete_path'] = 'dl/autocomplete/test';
do not, stay as normal textfield
function dl_form_views_exposed_form_alter(&$form, &$form_state, $form_id) {
$form['field_media_from_reference_nid']['#type'] = 'textfield';
$form['field_media_from_reference_nid']['#autocomplete_path'] = 'node_reference/autocomplete/node/field_media_from_reference';
$form['test']['#type'] = 'textfield';
$form['test']['#autocomplete_path'] = 'dl/autocomplete/test';
...
}
function dl_menu() {
$items['dl/autocomplete/test'] = array(
'title' => 'dl autocomplete',
'page callback' => 'dl_autocomplete_test',
'type' => MENU_CALLBACK,
);
return $items;
}
function dl_autocomplete_test($string = '') {
$matches = array("hello", "aloha");
drupal_json_output($matches);
}
any help appreciated!!
Comments
give access callback
clear cache and try