jQuery autocomplete to get unused value
<p>In my ASP.Net MVC application I have a jQuery autocomplete on a text box. I have everything working to display currently used item names and what I want to do is force the user to enter a completely NEW item name. I.e. the autocomplete acts as a guide to what exists but the user must ultimately enter a completely used string value.</p>

<p>I want the UI to signal if a currently used item is selected (there will be anther check on the server side when submit is posted) so for the moment there is just a simple alert().</p>

<p>My script is as follows:</p>

<pre><code>    $(document).ready(function() {
        $('#combobox').autocomplete('&lt;%= Url.Action("ProjectIdList", "LookUp") %&gt;', {
    delay:10,
    minChars:1,
    matchCase: 0,
    matchSubset: 1,
    autoFill: true,
    maxItemsToShow:10,
    cacheLength: 10,
    onItemSelect:selectItem,
    onFindValue:selectItem    
    });
</code></pre>

<p>});</p>

<p>Please note the markup:
<strong>onItemSelect:selectItem, onFindValue:selectItem</strong> </p>

<p>I have further script as follows:</p>

<pre><code>    function findValue(li) {
        if (li != null) return alert("This Project Id cannot be used");


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

    }
</code></pre>

<p>However, <strong><em>I cannot get these events to fire</em></strong>. What am I missing?</p>

<p>Alternatively, is there a better way to do this?</p>
