I see examples but no actual documentation for this plug-in or the
orignial from Dylan Verheul.  I would love to get rid of my
scriptaculous uses of autocomplete, but I have yet to figure out how
to match what I do there with Dan's or Dylan's plug-in for jQuery.

So my questions for these plug-ins:
A, what are the minimum function calls to attach to a text field to
make it an autocomplete;
B, what is the expected format of the output results.

With my current implementation of scriptaculous, I'm doing this:

<script>
function getSelectionId(text, li) {
                if (li==undefined || li.tagName != 'LI') return;
                var name = document.getElementsByClassName("name", li)
[0].collectTextNodes().strip();
                var oun = document.getElementsByClassName("oun", li)
[0].collectTextNodes().strip();
                document.myform.person.value = name;
                document.myform.relID.value = oun;
}
</script>

<input name="person" type="text" class="Text3" id="person" /><input
type="hidden" name="relID" />
        <div id="container1" class="autocomplete"></div>
        <script type="text/javascript" language="javascript" charset="utf-8">
new Ajax.Autocompleter("person", "container1", "includes/tools/
people.lasso?list=reps", {paramName: "query", minChars: 2,
indicator:"indicator2", afterUpdateElement: getSelectionId});
</script>


The results page returns this for each item found:
<li><span class="name">my matched name</span><span class="oun">my oun</
span></li>

Thanks for help :-)


On Apr 5, 9:16 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> Great. This is very good news. Thanks Dan.
>
> Rp
>
> On Apr 5, 10:40 am, "Dan G. Switzer, II" <[EMAIL PROTECTED]>
> wrote:
>
> > Randy,
>
> > >For those using Dan Switzerautocompletemodule based on Dylan
> > >Verheul's plug-in, how do the db calls work once a connection is
> > >opened with the ajax option? For instance, if I set the minChars:2 and
> > >type in Jo, it queries all cities that start with Jo. But what happens
> > >as I contitue to type? Is Joh a new db call? And then Johns, another
> > >call, and so on? Or is the initial call stored in chache?
>
> > It's amazing how quickly you forget stuff--especially when you just modded
> > someone elses code. :)
>
> > First, theAutocompleteplug-in uses a keyboard delay before querying the
> > server. This should avoid AJAX calls for each letter that's pressed
> > (provided it's configured that way--which it's not by default.)
>
> > By default, the library expects that if the user types in "Jo" that the AJAX
> > call will return all possible matches for the string "Jo". Provided the
> > results for the "Jo" call are still cached, there should be no additional
> > server traffic for any phrases starting with "Jo".
>
> > This can be controlled with the "matchSubset" option. By default this is
> > turned on. If you set it to false (or 0,) then a new AJAX call would be made
> > for "Jo", "Joh" and "John".
>
> > Also, you may want to be aware of the "matchCase". By default this is set to
> > false, so it's expecting the server to return case insensitive results. If
> > this option was set to true, then the string "Jo" is not the same as "jo".
>
> > Hope this helps!
>
> > -Dan

Reply via email to