I´m trying to use the JQuery UI Autocomplete plugin (click to see the demo page of JQuery UI Autocomplete plugin)
I´m using as datasource a list of objects as bellow:
I´ve solved the issue creating the handlers for OnFocus and OnSelect and returning false in each one.
function OnFocus(event, ui)
{
$( "#txtCidade" ).val( ui.item.label );
return false;
}
function OnSelect(event, ui)
{
var item = ui.item;
var itemLabel = item.label;
var itemValue = item.value;
var campo = $("#txtCidade");
$("#hidCidade").val(itemValue);
$("#txtCidade").val(itemLabel);
var campoValue = campo.val();
var hidCampoValue = $("hidCidade").val();
return false;
}