Hi,
  I'm trying to use jQuery and the autocomplete plugin for the first
time in a web application, so maybe I've made a gross mistake in using
it. I tried to start with a plain copy and paste of the example
provided implementing my own service for retrieving the data.
  The behavior I'm having, that is different from the one of the
example, is that after I digited 4 characters, the autocomplete box
just disappear, or better, it is there but without any alement inside
(and I am sure that the list has at least 2 elements inside that match
the edited input.
  I've searched the forum for similar problems but I didn't find
anything similar. Is it a trivial problem of wrong cut and paste? Can
anybody help me?
  Thanks in advance
  Gianluca C.


  The html code is the following:

 ...
<h2 class="title">RKB Explorer</h2>
<table>
<tr>
      <td>  <label for="rkbexplorer_uri">RKB Explorer uri:</label></
td>
      <td>  <input id="rkbexplorer_uri" type="text"
name="rkbexplorer_uri" maxlength="200" style="width:255px;"/></td>
</tr>
</table>
...
<script type="text/javascript">
function findValue(li) {
    if( li == null ) return alert("No match!");
    // if coming from an AJAX call, let's use the CityId as the value
    if( !!li.extra ) var sValue = li.extra[0];
    // otherwise, let's just display the value in the text box
    else var sValue = li.selectValue;
}

function selectItem(li) {
    findValue(li);
}

function formatItem(row) {
    return row[1];
}

function lookupAjax(){
    var oSuggest = $("/search/person/")[0].autocompleter;
    oSuggest.findValue();
    return false;
}

$(document).ready(function() {
    $("#rkbexplorer_uri").autocomplete(
        "/search/person/",
        {
            delay:1,
            minChars:3,
            matchSubset:1,
            matchContains:1,
            cacheLength:100,
            onItemSelect:selectItem,
            onFindValue:findValue,
            formatItem:formatItem,
            matchSubset: true,
            autoFill:false
        }
    );
})
</script>
...

The service used, "search/person/" retrieve contacts of people in the
right format:

uri1 | name1
uri2 | name2
uri3 | name3
uri4 | name4
uri5 | name5

Reply via email to