Jorn,
Thanks for sticking w/ me...I almost have it!

However below is the url i'm sending but the "q" value is not being
recognized in my servlet...I'm I sending it over correctly?

//JAVASCRIPT
$(function()
{
     $("#name").autocomplete("employeedirectory?command=ajax&q=" +
document.forms[0].empName.value
          + "&limit=10");
});

//IN THE HTML
Name:<input type="text" name="empName" id="name">

//TRYING TO RECOGNIZE "Q" VALUE IN SERVLET
String dataInput = req.getParameter("q").toUpperCase();

Thanks so much!!

Jörn Zaefferer wrote:
> Look:
>
> $(function() {
>   $("#name").autocomplete("someurl");
> });
>
> That does nothing but bind a few event handlers. It doesn't create DOM
> elements, nor does it load any records.
>
> As soon as the user starts typing, the keyup-event-handler loads some
> data via ajax - how many rows are returned is up to your serverside.
> It then creates the necessary DOM elements to show the result list and
> adds event handlers to that (for keyboard navigation etc.).
>
> I hope that gives you a better idea how it works.
>
> Jörn
>
> On Mon, Aug 25, 2008 at 8:22 PM, kreiss <[EMAIL PROTECTED]> wrote:
> >
> > First of all...thanks for the help!
> > I have about 4500 records in the database  (its an employee
> > database)...if I understand correctly...on the document ready should I
> > bring in all 4500 records?  Would the autocomplete be slow to respond
> > due to all the records....
> >
> > The reason I was doing an onKeyUp is so I could limit the number of
> > records that the servlet brought back, keeping the array in javascript
> > smaller..
> >
> > My question is am I supposed to bring back ALL records on the document
> > ready?
> >
> > Thanks so much.
> >
> >
> >
> >
> >
> >
> > Jörn Zaefferer wrote:
> >> You're binding the autocomplete on keyup, which binds another keyup
> >> event - every time. Remove your inline event handler and initialize
> >> the autocomplete just once on document ready.
> >>
> >> Jörn
> >>
> >> On Mon, Aug 25, 2008 at 4:52 PM, kreiss <[EMAIL PROTECTED]> wrote:
> >> >
> >> > Following the documentation, it seems I'm doing it correctly...I'm
> >> > getting data back from my database, but I just have to click out of
> >> > the textbox first before I see the data, other than that it works
> >> > great.
> >> >
> >> > Jörn Zaefferer wrote:
> >> >> Please take a look at the examples here:
> >> >> http://dev.jquery.com/view/trunk/plugins/autocomplete/demo/
> >> >>
> >> >> The "remote" examples are based on PHP, but still show the essential
> >> >> stuff. You've got it all mixed up.
> >> >>
> >> >> Jörn
> >> >>
> >> >> On Fri, Aug 22, 2008 at 9:57 PM, kreiss <[EMAIL PROTECTED]> wrote:
> >> >> >
> >> >> > I'm close to getting the autocomplete to finally work...but.....
> >> >> >
> >> >> > First of all, I'm using Java / .jsp to query a database for results
> >> >> >
> >> >> > I'm sending the url to my servlet, my servlet passes the data back to
> >> >> > the .jsp page....Nothing appears in my dropdown UNLESS I use my mouse,
> >> >> > click outside of the textbox and then click back into it.  Then the
> >> >> > autocomplete works great and displays the data from the database
> >> >> >
> >> >> > I've tried IE, Opera, Firefox and everyone of them requires me to
> >> >> > start typing in the text box, click out, click back in then the
> >> >> > autocomplete displays.
> >> >> >
> >> >> > Is this a bug or am I'm doing something wrong.
> >> >> >
> >> >> > I've read something in this form about a guy wanting to know if there
> >> >> > was a "reinitialize" function that could be called in the javascript
> >> >> > once the data was brought back from the servlet...I didn't see a
> >> >> > solutions, but think maybe this is what I need.
> >> >> >
> >> >> > Here is sample code:
> >> >> >
> >> >> > //JavaScript Code
> >> >> > function getNames()
> >> >> > {
> >> >> >      $("#name").autocomplete("employeedirectory?command=ajax&q=" +
> >> >> > document.forms[0].test.value + "&        limit=10");
> >> >> > }
> >> >> >
> >> >> > //HTML
> >> >> > Name:
> >> >> > <input type="text" id="name" onkeyup="getNames()
> >> >> >
> >> >> > Thanks in advance
> >> >> >
> >> >> >
> >> >> >
> >> >> >
> >> >
> >

Reply via email to