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

  • SEARCH
  • Home
  • 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 7605787
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T00:15:18+00:00 2026-05-31T00:15:18+00:00

I have an autocomplete field and have it’s source set to an array of

  • 0

I have an autocomplete field and have it’s source set to an array of friends.

 GetFollowing(9, function(response)
                    {
                        if (response)
                        {
                            donor.following = response;
                            for (var i = 0; i < response.length -1; i++)
                            {
                                // make sure we have an image to display
                                if (response[i].image != null)
                                {
                                    $("#following").prepend("<li title='" + response[i].firstname + " " + response[i].lastname +
                                        "'><img src='<?php echo $baseUrl;?>/uploads/profile-pictures/" + response[i].image +
                                        "' alt='" + response[i].firstname + " " + response[i].lastname + "'/></li>");

                                    // add to the friends array
                                    if (! $.inArray(response[i].firstname + " " + response[i].lastname, friends))
                                        friends.push(response[i].firstname + " " + response[i].lastname);
                                }
                            }
                        }
                    });
                    GetFollowers(9, function(response)
                    {
                        if (response)
                        {
                            donor.followers = response;
                            for (var i = 0; i < response.length -1; i++)
                            {
                                // make sure we have an image to display
                                if (response[i].image != null)
                                {
                                    $("#followers").prepend("<li title='" + response[i].firstname + " " + response[i].lastname +
                                        "'><img src='<?php echo $baseUrl;?>/uploads/profile-pictures/" + response[i].image +
                                        "' alt='" + response[i].firstname + " " + response[i].lastname + "'/></li>");

                                    // Add to the friends array
                                    friends.push(response[i].firstname + " " + response[i].lastname);
                                }
                            }
                        }
                        // setup jquery-ui autocomplete
                        $("#msg-to").autocomplete({source: friends});
                    });

My problem is I need to associate an id with the value that is selected, how can this be done?

  • 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-31T00:15:19+00:00Added an answer on May 31, 2026 at 12:15 am

    http://jqueryui.com/demos/autocomplete/

    you should read the overview more.

    Expected data format

    The data from local data, a url or a callback can come in two
    variants:

    • An Array of Strings:

    [ "Choice1", "Choice2" ]

    • An Array of Objects with
      label and value properties:

    [ { label: "Choice1", value: "value1" }, ... ]

    The label property is displayed in the suggestion menu. The value will be inserted into the input element after the user selected something from the menu. If just one property is specified, it will be used for both, eg. if you provide only value-properties, the value will also be used as the label.

    use the label for textual representation, the value for the id per item in the selection.

    you should also differentiate the textbox used for the visual version (which displays words) from the data version (a hidden input which contains id’s) – similar to those of the datepicker widget (aka. alternate data). this can all be manipulated using the settings.

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

Sidebar

Related Questions

I have the following code: var acOptions = { source:function (request, response) { $.ajax({
I have an jQuery.autocomplete field presenting a limited range of decimal numbers. Ex: var
I have an autocomplete field using local JSON data. $( #tags ).autocomplete({ source: get_items,
I have a jQuery Autocomplete field on an ASP.Net Webform and everything has been
I have a simple autocomplete field that spits out a bunch of suggested words
I have a jquery autocomplete field working fine followed by a date input field.
i have a textinput field which has autoComplete, i populate its dataprovider from a
I'm using Jorn Zaefferer's Autocomplete query plugin, http://bassistance.de/jquery-plugins/jquery-plugin-autocomplete/ I have options set so it
I have an autocomplete field which I would like to augment by providing a
I have a page with an ajax filled autocomplete field, if an extra addition

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.