Not exactly i think, but you can implement next:
$form['node_taxonomy_term'] = array(
'#type' => 'textfield',
'#autocomplete_path' => 'ntt/autocomplete',
);
add menu callback for autocomplete path
function HOOK_menu() {
$items = array();
$items['ntt/autocomplete'] = array(
'page callback' => 'node_taxonomy_term_autocomplete',
'page arguments' => array(2),
'type' => MENU_CALLBACK,
);
return $items;
}
and add callback function
function node_taxonomy_term_autocomplete($str = 0) {
$matches = array();
//vocabulary id
$vid = 2;
$result = db_select('taxonomy_term_data', 't')
-> fields('t', array('tid', 'name'))
-> condition('vid', $vid, '=')
-> condition('name', $str.'%%', 'LIKE')
-> range(0, 10)
-> execute();
foreach ($result as $term) {
$matches[$term -> tid] = check_plain($term -> name);
}
drupal_json_output($matches);
}
enjoy