Autocomplete plugin, get different data to that entered

Autocomplete plugin, get different data to that entered


Hi everyone
Been experimenting with the autocomplete plugin (http://
docs.jquery.com/Plugins/Autocomplete/autocomplete#url_or_dataoptions)
Couldn't wait until it was incorporated into jQuery UI ;)
What I'm trying to achieve is to use the box to search for a company,
but actually to get hold of the company ID then save that into my
database.
At the moment users have to look up the company_id manually and enter
it into a field, which is totally stupid these days!
I've been using the Single Bird (remote) example on this page...
http://view.jquery.com/trunk/plugins/autocomplete/demo/
That demo gets the data from this script...
http://view.jquery.com/trunk/plugins/autocomplete/demo/search.phps and
you notice in the output it returns 2 values separated by a | pipe
character. The bird name and the latin name.
Got my server-side script sorted and I've been trying to adapt that
example so it returns:
company_name|company_id
company_name2|company_id2
The autocomplete seems to work (though I need to tweak the options a
bit to get it perfect) but how do I access the value after the | pipe
character?
It's that company_id that I'm actually trying to get hold of in my
script
Sort of like how the option HTML tag behaves... <option
value="company_id">company_name</option>, so the user only sees
company_name, but actually they're entering company_id into my form.
Any ideas/suggestions on the best way to do this?
Cheers, B