Basically I have the same problem as described here: How to make autocomplete return nid and name?.

I have a text input with ajax autocomplete:

$form['rmanager_id'] = array(
    "#title" => t("Manager"),
    '#type' => 'textfield',
    '#autocomplete_path' => 'members/managers',

In /members/managers the function is invoked that returns {id => Name} pair. But when I select a name from the drop-down his id is inserted into the textfield. I would like to insert the name there and put the id into a hidden field.

@Clive who commented the previous question didn't give any code samples. I googled, but didn't find anything. Can somebody give a minimal working example to achieve this?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.