Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6693977
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:02:55+00:00 2026-05-26T06:02:55+00:00

So, i have read at least 20-30 auto complete problems here on so and

  • 0

So, i have read at least 20-30 auto complete problems here on so and i cannot find any solutions. For some odd reason i keep getting value = undefined. Here is my code.

//Cycles through each input and turns it into a person searcher.
$.each(settings.input, function() {
    var input = $(this);
    input.autocomplete({
        delay: 70,
        minLength: 2,
        source: function(req, add) {
            var val = input.val();

            $.post(VUI.SITE_URL + "scripts/autocomplete/_AutoComplete.php", {q: val, display_count: settings.displayCount, action: "user"}, function(data) {
                data = eval("(" + data + ")");

                if (data.length > 0) {
                    var results = new Array(data.length);
                    $.each(data, function(key, value) {
                        results[key] = {desc: value, value: value.firstname + " " + value.lastname};
                    });
                    add(results);
                } else {
                    add(["No results..."]);
                }
            });
        },
        select: function(event, ui) {
            alert(ui.item ? ("Selected: " + ui.item.value + " aka " + ui.item.id) : "Nothing selected, input was " + this.value);
        }
    }) // end auto complete.
    .data("autocomplete")._renderItem = function($ul, item) {
        var $li = $("<li></li>"),
            $inner = $("<div class='st-display side-content clearfix'style='padding-top:6px'></div>"),
            $a = $("<a></a>"),
            $img = $("<div class='image fl'></div>").html(ST.Image.getImage({
                uid: item.desc.uid,
                type: ST.ST_IMAGE_TYPE_THUMBNAIL_SMALL
            })),
            $content = $("<div class='content fl'></div>").html(
                item.desc.firstname + " " + item.desc.lastname + "<br/>" +
                "<span class='color:#979797;font-weight:bold'>" + item.desc.city + ", " + item.desc.state + "</span>"
            );

        $inner.append($img).append($content);
        $a.append($inner);
        $li.append($a);
        $ul.append($li); 

        return $ul;
    } // end _renderItem */

I tried to make it so that its very straight forward. But it wont work! (its facebook like auto complete). The auto complete displays properly (item does not equal undefined at that point), but when i highlight it, item becomes undefined so item.value (line 6347 of jquery.ui.1.8.13) throws exception!

Anyone see problems?


Here is something interesting… When i do not use data(“autocomplete”)._renderItem (for custom completion) the selecting works! … So why does overriding the custom rendering cause issues? I am even returning the UL.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T06:02:55+00:00Added an answer on May 26, 2026 at 6:02 am

    The only thing in your code that’s different from a working version I’ve got of something very similar is that I initialise $li with:

    var $li = $( '<li></li>' ).data('item.autocomplete', item);
    

    That attaches the data to the list item which I think the autocomplete plugin uses to get the value at selection time.

    Hope it helps

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have read some of the questions and answers here, but it none match
I have read a lot of topic here and people tend to store IP
Hi guys I was hoping from some help here, please. I have a INSERT
I have read here http://search.cpan.org/~frew/DBIx-Class-0.08200/lib/DBIx/Class/Manual/Cookbook.pod#Setting_default_values_for_a_row that a way to set default values for columns
I have read at least one class should contain Main method since the entry
For some reason, I cannot get a UIWebView to play nice with my new
I have read the documentation at least 10 times now and have also read
I have read many answers to questions about dynamically resizing NSWindows and nothing has
I have read various posts in stackoverflow and I am trying to figure out
I have read the Apple documentation, and many postings on the subject on SO,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.