[autocomplete] minchars bug
Hi, I noticed on the autocomplete module with JQ 1.3 that the minChars is'nt quite totally happy. I noticed someone posted a fix to it on the <a href="http://baasistance.de">baasistance.de</a> site in 2008 but it has'nt made it to the codebase. Maybe someone here is watching and will update?
Specifically, with a local array, the minChars only works with 0 or 1. Otherwise nothing happens. This is with something like :
<pre id="line296"><<span class="start-tag">script</span><span class="attribute-name"> type</span>=<span class="attribute-value">"text/javascript"</span>>//<![CDATA[
$(function(){
$("#recipient").autocomplete(
['<a href="mailto:joe@home.com">joe@home.com</a>','<a href="mailto:andre@home.com">andre@home.com</a>','<a href="mailto:sa@home.com">sa@home.com</a>','<a href="mailto:fred@home.com">fred@home.com</a>','<a href="mailto:jerry8@home.com">jerry8@home.com</a>','<a href="mailto:654654@homwe.com">654654@homwe.com</a>','<a href="mailto:freddy@home.com">freddy@home.com</a>'],{
'minChars':2
,'mustMatch':false
});
});
//]]></<span class="end-tag">script</span>>
</pre> The fix which seems to work is spelled out by Kumar Ram on <span class="commentdate">11. August 2007 |01:26</span> on <a href="http://baasistance.de">baasistance.de</a>.
on line 536 switch
for (var i = q.length - 1; i >= options.minChars; i–)
to
for (var i = q.length - 1; i >= 0; i–) {
I've only tested with that declaration so hopefully, there are some unit tests that can confirm it does not break anything.
Hopefully this helps someone.<br clear="all">
--
DRE
<a href="http://www.itestcars.com">http://www.itestcars.com</a>
<a href="http://www.increasetheknowledge.com">http://www.increasetheknowledge.com</a>
<a href="http://www.theanticool.com">http://www.theanticool.com</a>