Click here to Skip to main content
15,921,941 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi all,

Finishing my time tracker project...

I've used jquery-ui to autocomplete some edit fields.

It works very well, but I have not figured how to force the autocomplete to happen when the page loads if the editbox is full.

I've done this:

$( function() {
      minlength: 1,
      source: function(request, response) {
          url: "autocompleteDatasource.php",
          dataType: "json",
          data: {
            term : request.term
          success: function(data) {
      focus: function(event, ui)
        return false;
      select: function(event, ui)
        var country = "";

        if ( != null) country = + '\n';
        if ( != null) id =;

        $("#taUbi").val(country + id);
        return false;
    .autocomplete("instance")._renderItem = function(ul, item){
      return $( "<li>" )
      .append( "<div>" + + "</div>" )
      .appendTo( ul );

With this code, I can start typing into edUbi (the textBox) and a list appears with values that are like the written text.

Once I select an option from the list edUbi a textArea control gets filled with country and id (I've reduced the list, but all the location data is there).

Is it possible to execute the query and fill taUbi with the correct values when I load the page and the edUbi control gets filled?

How should I do it?

Any idea?

Thank you very much for your time and help!

What I have tried:

Multiple syntax, searched Internet to find a description of the way to do it without luck.
Updated 23-Oct-19 8:17am

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900