Local autocomplete issue when searching for 'IN' string

3 views
Skip to first unread message

Manuel Corrales

unread,
Nov 18, 2009, 9:44:48 AM11/18/09
to Prototype & script.aculo.us
Hello, I am using a local autocomplete and everything is working fine
except when I search using the IN letters. When I search like that,
the drop down menu show the first match and then other 9 items that do
not match the search. This is only happening with this string. I think
this maybe because I have this setup and the word "informal" is in all
items? How can I solve this?


new Autocompleter.Local('search_stpr', 'div_search_stpr', ['WI<span
class="informal"> - Wisconsin</span>','GA<span class="informal"> -
Georgia</span>','MD<span class="informal"> - Maryland</span>','ME<span
class="informal"> - Maine</span>',....], {fullSearch:true});


Thanks in advance!!

david

unread,
Nov 23, 2009, 3:30:04 PM11/23/09
to Prototype & script.aculo.us
Hi manuel,

the autocomplter check on the string you enter in the array, not
inside the generate code.
I only think to one thing, delete the HTML markup inside the
autocomplter.
this autocompleter does almoth the same as yours:
new Autocompleter.Local('search_stpr', 'div_search_stpr',['WI -
Wisconsin','GA - Georgia','MD - Maryland','ME - Maine'],
{fullSearch:true});

But if you still need some styling, just set the HTML code and styling
will match elements by using CSS selectors. But in that case if you
still enter sp, spa, span, all elements are returned

There is the possibility to pass instead of the array of possibles
values a function which will do the checking, but that more difficult.

Or one possibility is to set the partialSearch parameter to false so
that the autocompleter will only check at the beginning of the string
to find a match. but entering 3 letter will have no effects. Or invert
the initial of the state with it's name, and style by defaul the name
and add some HTML code to style the initial (the partialSearch
parameter is still set to false).

hope that help.

--
david
Reply all
Reply to author
Forward
0 new messages