views:

679

answers:

1

I am using this jquery plugin.

I've looked at the documentation but I'm still not sure how to get the key value from the selected item.

http://bassistance.de/jquery-plugins/jquery-plugin-autocomplete/

A: 

You should have some kind of callback function, like this one (those functions are from demo):

function findValueCallback(event, data, formatted) {
    $("<li>").html( !data ? "No match!" : "Selected: " + formatted).appendTo("#result");
}

And then you should add this function as a handler for "result" event on your textboxes:

$(":text, textarea").result(findValueCallback).next().click(function() {
    $(this).prev().search();
});
ppiotrowicz
ok. Doesn't that mean I will have to make a call back to the database to find out the key?
Dkong