Jquery Autocomplete... Please Help


I am trying to get the feature which was discussed in


But, I simply can’t do it. Can any one please help me on getting this implemented with a sample code ? I tried with many jquery plugins, but none of them works.

All I am trying to do is to have an autocomplete text box on a LightBox which fetches a customer database from a MySQL database…


The thread you linked to was the one I posted awhile back. I use jQuery-UI Autocomplete http://jqueryui.com/demos/autocomplete/

I can’t help you with the back-end coding from MySQL, but to make it work the the Scheduler you need to call the autocomplete on the onLightbox event. Here’s a short sample of my code that builds on the code from the previous thread.

scheduler.attachEvent("onLightbox", function (event_id) {
       // autocomplete is called here

I separate the autocomplete search function from the event above because I have a lot going on inside the event. However, you could write the autocomplete search right in there.

// tbox is the id of the autocomplete search box
Cal.autocomplete = function (tbox) {
    $('#' + tbox).autocomplete({
        source: function (request, response) {
                   // the url that will return your JSON result set
                    Page.search + '?term=' + request.term,
                    function (j) { response(j); }
        minLength: 3,
        focus: function (event, ui) {
            return false;
        select: function (event, ui) {
            //do what you like here when user selects an autocomplete option
            return false;

Finally, here’s a sample of the JSON result I return to the Cal.autocomplete function.

[{"label":"Bruce Banner","value":16086},{"label":"Peter Parker","value":41511},{"label":"Bruce Wayne","value":38572},{"label":"Clark Kent","value":13342}]