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 7436129
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:11:23+00:00 2026-05-29T10:11:23+00:00

First, sorry about the title of this question. I thought about it for a

  • 0

First, sorry about the title of this question. I thought about it for a long time and could do no better.

My question is: can jQueryUI’s autocomplete feature provide suggestions from multiple database fields under one autocomplete field. For instance, I’d want to be able to type in “br” in the field and have both “briman057” and “Brian Johnson” appear as suggestions even though they are stored in separate database fields and are returned as two separate key value pairs of the same JSON item (ie. [{username : briman057, name : ‘Brian Johnson’]}). I’d then want the username value to be the one that populates the field when either it or the full name are selected. I know that one of the keys needs to be named “value” or “label” and that the key by that name is the one that is used to provide suggestions, but can I essentially have two “value” keys for one JSON item?

  • 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-29T10:11:24+00:00Added an answer on May 29, 2026 at 10:11 am

    Yes, it can, because you provide your own custom callback as a datasource. That callback can implement the behaviour you desire.

    Here’s a demo of what I think you want.

    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js"></script>
    <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/themes/ui-lightness/jquery-ui.css" type="text/css" media="all" />
    <script type="text/javascript">
    $(function() {
      $('#myautocomplete').autocomplete({
        source: function(request, response) {
          // TODO: make suggestions actually depend on what the user types into the search box.
    
          // You want two suggestions, one with 'briman57' and one with 'Brian Johnson', so we need two suggestions with different labels, but with the same value.
          var suggestions = [
            { label: 'briman057'    , value: 'briman057', username : 'briman057', name : 'Brian Johnson'},
            { label: 'Brian Johnson', value: 'briman057', username : 'briman057', name : 'Brian Johnson'}
          ];
          response(suggestions);
        },
        select: function( event, ui ) {
          alert('You have selected ' + ui.item.name + ' (' + ui.item.username + ')');
        }
      });
    });
    </script>
    <input id="myautocomplete" title="Enter anything here."></input>
    

    Take a look at the source code of the Remote JSONP datasource example for more inspiration.

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

Sidebar

Related Questions

First, I'm sorry for the question title but I can't think of a better
First and foremost, I'm so sorry about how long this question is and appreciate
Well, first of all sorry about this question it must be pretty straight forward
First of all, I'm sorry about the feedback-nature of this question. I'm trying to
First, I'm sorry about the title, that was the best I could come up
Sorry about the rubbish question title. I have a table SET_DEFINITIONS like this: SETKEY
First of all, I'm sorry about the title. I couldn't find a better one.
First of all, sorry about that title. I'm not the best at writing those
sorry about the funky title, I was having trouble coming up with one. First
First I am sorry about the length of this post, but I wanted to

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.