[jQuery] findValue
[jQuery] findValue
Hi Experts,
i have been working on this since monday and still i dont seem to have a clue what is stopping it from working.
What i am trying to do:
I have an autocomplete inputbox which displays matching results from the database as soon as the user starts typing.
My problem is:
If a user start typing a characters into the autocomplete inputbox and there's no matching result from backend,
i want a message "We donot have anything matching this search" to be displayed.
Currently i am using this code:
<span style="color: rgb(0, 102, 0);">function findValue(li) {</span><br style="color: rgb(0, 102, 0);"><span style="color: rgb(0, 102, 0);"> var $Suggest = $("#operator")[0].autocompleter.findValue();</span><br style="color: rgb(0, 102, 0);">
<span style="color: rgb(0, 102, 0);"> if($Suggest == null){</span><br style="color: rgb(0, 102, 0);"><span style="color: rgb(0, 102, 0);"> alert("we donot have any matching result");</span><br style="color: rgb(0, 102, 0);">
<span style="color: rgb(0, 102, 0);"> }</span><br style="color: rgb(0, 102, 0);"><span style="color: rgb(0, 102, 0);"> return false;</span><br style="color: rgb(0, 102, 0);"><span style="color: rgb(0, 102, 0);">}</span><br style="color: rgb(0, 102, 0);">
<br style="color: rgb(0, 102, 0);"><span style="color: rgb(0, 102, 0);">$(document).ready(function(){</span><br style="color: rgb(0, 102, 0);"><span style="color: rgb(0, 102, 0);"> $("#input").autocomplete("auto.php",</span><br style="color: rgb(0, 102, 0);">
<span style="color: rgb(0, 102, 0);"> {</span><br style="color: rgb(0, 102, 0);"><span style="color: rgb(0, 102, 0);"> delay:10,</span><br style="color: rgb(0, 102, 0);"><span style="color: rgb(0, 102, 0);"> lineSeparator: "^",</span><br style="color: rgb(0, 102, 0);">
<span style="color: rgb(0, 102, 0);"> cacheLength: 10,</span><br style="color: rgb(0, 102, 0);"><span style="color: rgb(0, 102, 0);"> matchSubset:1,</span><br style="color: rgb(0, 102, 0);"><span style="color: rgb(0, 102, 0);"> matchContains:1,</span><br style="color: rgb(0, 102, 0);">
<span style="color: rgb(0, 102, 0);"> onFindValue:findValue,</span><br style="color: rgb(0, 102, 0);"><span style="color: rgb(0, 102, 0);"> formatItem:formatItem,</span><br style="color: rgb(0, 102, 0);"><span style="color: rgb(0, 102, 0);"> autoFill:true</span><br style="color: rgb(0, 102, 0);">
<span style="color: rgb(0, 102, 0);"> });</span><br style="color: rgb(0, 102, 0);"><br style="color: rgb(0, 102, 0);"><span style="color: rgb(0, 102, 0);">return false;</span><br style="color: rgb(0, 102, 0);"><span style="color: rgb(0, 102, 0);">)};</span>
I am currently totally lost as i have tried everything but doesn't seems work. Can anyone help?
Ta!
B