Shawn, yes, that is the plugin I am talking about.  In Jorn's blog
post on Autocomplete he said to post here with [Autocomplete] in the
subject if having problems.

Here's the code I'm using:

$("#client_name").autocomplete("/ac/get_clients/", {
        scroll: true,
        scrollHeight: 300,
        autoFill: true,
        cacheLength: 1,
        max: 20,
        matchContains: false
});

I also have a .result(function(){}); running after that as well so I
can populate a form with the returned data from the autocomplete.
I'm using CodeIgniter as my php framework utilizing a library called
DataMapper which is an implementation of an ORM.  Here's the function
I'm using to return the data:

function get_clients()
{
        $c = new Client();
        $c->get();
        $q = strtolower($_POST['q']);
        if ( ! $q)
                return;
        foreach ($c->all as $client) {
                if (strpos(strtolower($client->name), $q) !== false) {
                        echo "$client->name|$client->id\n";
                }
        }
}

On May 19, 5:36 pm, Shawn <sgro...@open2space.com> wrote:
> There are a few different autocomplete plugins out there.  I'll assume
> you are using the one found 
> athttp://bassistance.de/jquery-plugins/jquery-plugin-autocomplete/ (which
> is the one documented at docs.jquery.com)  The author, Jorn Zaefferer,
> is on this list often....
>
> I've seen oddities like this with the plugin, but it pretty much always
> was a problem in how I was implementing the plugin.  Or a potential
> problem with my server side code or local network.  But I tend to do
> more than the absolute basics too, so I always assume it's my fault
> first.. :)
>
> Short of seeing some sample code, I'm not sure how much more I can help
> out... But hope that points you towards the solution somewhat.
>
> Shawn
>
> MeanStudios wrote:
> > Greetings,
>
> > I'm currently using this awesome plugin for my web app but I'm having
> > a bit of an annoying bug with it.  It sometimes does not pull up any
> > results when typing in.  Like if I have something in the database with
> > the name "March" and I type in "mar" it shows the little loading.gif
> > but then disappears and doesn't give me any results.  If I tab away
> > and come back to it and try it again, then it will work.  And even
> > that doesn't make it work.  Sometimes I have to totally refresh the
> > page.  I thought it might be the cache mechanism so I turned that off
> > setting "cacheLength" to "1".
> > Any other ideas as to why it sometimes works and sometimes doesn't?

Reply via email to