Oh, and use Dan's version, he squashed a few bugs and added cool things :-)

On 4/8/07, Dylan Verheul <[EMAIL PROTECTED]> wrote:
http://www.dyve.net/jquery/autocomplete.txt

(sorry to be this brief, it's 5:50am here)

On 4/7/07, Shelane <[EMAIL PROTECTED]> wrote:
>
> One more thing I forgot to mention.
>
> In this example here, I'm only returning 2 values within the found
> data.  There are cases where I might want to pass back 5 different
> pieces of info (address, city, state, etc), but maybe only show 1 or 2
> of those items for the user to see in the drop down.  Maybe I only
> want one of those items to show in the autocomplete box once selected,
> but I want to populate other hidden fields with the other pieces of
> information (like my example).
>
> On Apr 7, 12:43 pm, "Shelane" <[EMAIL PROTECTED]> wrote:
> > 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