0

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/

Dkong
  • 2,748
  • 10
  • 54
  • 73
  • I've seen the source at http://docs.jquery.com/Plugins/Autocomplete I don't think you need to get keys or values for simple working. Plugin takes care of itself. If you have special requirements please elaborate and post code which you are trying. – TheVillageIdiot Jun 30 '09 at 04:45
  • There is something: http://stackoverflow.com/questions/9561365/value-is-applied-instead-of-label-to-textbox#autocomment12205408 –  Mar 08 '12 at 14:16

1 Answers1

0

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
  • 4,464
  • 3
  • 32
  • 46
  • ok. Doesn't that mean I will have to make a call back to the database to find out the key? – Dkong Jun 30 '09 at 05:37