Hello. I am using jQuery autocomplete from here : http://www.pengoworks.com/workshop/jquery/autocomplete.htm
$("#TestTextbox").autocomplete(
'<%= Url.Action("LookupAction") %>',
{
delay:10,
minChars:1,
matchSubset:1,
cacheLength:0,
onItemSelect:selectItem,
onFindValue:findValue,
formatItem:formatItem,
autoFill:false
}
);
function findValue(li)
{
if( li == null )
return alert("No match!");
if( !!li.extra )
var sValue = li.extra[0];
else
var sValue = li.selectValue;
alert(sValue);
}
function selectItem(li)
{
findValue(li);
}
function formatItem(row)
{
return row[0]; //value
}
the LookupAction return key|value list. if I add some button, to get the key for selected value in autocompleter, i'll have something like this :
function lookupAjax()
{
var oSuggest = $("#TestTextbox")[0].autocompleter;
oSuggest.findValue();
return false;
}
while i can see key for entered to textbox values via alert functions in findValue function, the question is : it possible to return them from there somehow ? (i.e. var retVal = oSuggest.findValue())
Thank You !