this was already asked here Handling id from autocomplete field
but still without answer: I have an autocomplete field which uses geonames query to search cities. After value is selected I want the city name and admin area to fill into the autocomplete field, and to fill geoname_id of selected value into another (hidden) field. I don't want the geoname_id to be visible - it looks kind of ugly...
I've tried to hack the autocomplete.js and added following line
$("#search-geoname-id").val($(this.selected).data('autocompleteValue'));
into Drupal.jsAC.prototype.hidePopup function
then also tried
$("input[id=search-geoname-id]").val($(this.selected).data('autocompleteValue'));
but both without effect :/
Thanks for your help, Tomas
Answer your own question
. This is not only acceptable, but encouraged.