Yeah, we've run into this same trouble as well. It would be nice if there was a hook to handle this built into Autocomplete.
On Mon, Jan 26, 2009 at 3:18 AM, Styx <pawel.chuchm...@gmail.com> wrote: > > It dosen't work. > For example: I use tab key to navigate. If focus is set to input, id > will be empty. If I don't want change my input, id also shouldn't be > change. > IAnother example: If my result work and set id properly, if I keypress > shift or ctrl, id field will be cleared. > > On 24 Sty, 00:20, Jörn Zaefferer <joern.zaeffe...@googlemail.com> > wrote: >> You could add another keyup-event-handler to the input field, and >> clear the id field. As long as that runs before the result-handler is >> setting the data, it should give you the result you need. >> >> Jörn >> >> On Fri, Jan 23, 2009 at 5:09 PM, Styx <pawel.chuchm...@gmail.com> wrote: >> >> > Hi. >> >> > I have two fileds. For exmple: >> >> > $("#name").autocomplete('seatch.php'); >> > $("#id").result(function(event, data, formatted) { >> > if (data) { >> > $("#id").val(data[1]); >> > } >> >> > If i select sometfing in autocomplete field, my id field will have id >> > of this item. After submit I have two fields - one wieth name, and one >> > with id. I can for example update dabase use id. >> >> > But if I write in autocomplete somethig, which isn't in result, my >> > function isn't triggered. If i edit existing data, after submit I have >> > field "id" with some value, and filed "name" with new value. I don't >> > know, that I shoul add my "name" to database, or do something else. >> >> > What I should do to clear field "id" when "name" is write by me and >> > dosen't exist in result of 'search.php'? >> >> > regards, >> > pch