views:

275

answers:

3
$("#suggest3").autocomplete(someArray, {
    multiple: true,
    mustMatch: true,
    autoFill: true

});

"Jhon Smith" 
"Borris Baker" 
"Dove Elliot"

Now in the above combination when i would type 'Jhon Smith' a value ( Jhon Smith ) will be available in the dropdown....But how to tweak so that even when i type 'Smith Jhon' still the value ( Jhon Smith ) is available for selection... :s

i.e. Like in Gmail no matter what is the sequence of the words included in the name of a person it shows that result as long as the 'Jhon' and 'Smith' is there... i.e. sequence doesn't matter.

A: 

The Jquery Autocomplete plug-in you are using probably can't be tweaked easily to your requirements. However you can get some hints from this script:
Source for "Google Contacts Autocomplete" – Userscripts.org

o.k.w
There must be a work around can you tell me the area of the code this matching tales place?
Raul Ruman
A: 

In my case, I pulled the result set from a database after I split the words and used a LIKE clause in the SQL.

EDIT: Just and FYI, I did a sort so that if they entered "Jhon Smith" it would put results in priority order:

Jhon Smith
Jhon Smithy
Jhon Friday
Carl Smith
Mark Schultheiss