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

Reply via email to