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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T11:26:29+00:00 2026-05-21T11:26:29+00:00

I have an input field (text) that I want to perform autocomplete on with

  • 0

I have an input field (text) that I want to perform autocomplete on with multiple names. It acts like the To: field in Gmail, with the user typing in a name and hitting enter and continuing. The problem is that I have a list of names and that’s what gets added to the input field and once you submit, as far as I know, only the field string gets sent to the server. The problem is when there are two people with the same name, so: John Smith, Bob, John Smith might be inputted and that string will get sent to the server.

On the backend, all users have a unique id. Is there any way I can have the users’ names be the autocomplete source but have their ids sent to the server?

I’m using jQuery 1.5.1 and this plugin: jQuery UI Autocomplete

  • 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-21T11:26:30+00:00Added an answer on May 21, 2026 at 11:26 am

    The standard search will offer up everything you need. You just need to use a $.map() function to get the data you need out from the server response. Example:

    ...
    success: function (data) {
       response($.map(data.d, function (item) {
          return {
             id: item.ContactId,
             value: item.LastName + ", " + item.FirstName
          }
       }))
    }
    ...
    

    Then just store the selected items (including the ids and names) in a $().data() variable on the input. Example:

    ...
    select: function (event, ui) {
       $(this).data("Selected", item);
    }
    ...
    

    Now when you’re ready to post your value back to the server, you can simply send the id of the selected entry like so:

    var idToSend = $("#autoComplete").data("Selected").id;
    

    I hope that helps. Good luck!

    * * EDIT * *

    Sorry, the $.map() was a split thought. The data.d in my example is .NET specific, but there are two properties that are native to the Autocomplete plugin (.value and .label).

    .value will be what is shown and stored if .label does not exist; otherwise, .value will be treated as the value stored in the input post-selection, and .label will be what is displayed in the dropdown.

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

Sidebar

Related Questions

I have a text input field like text box or text area. I want
I have a jQuery jPicker colorpicker that is bound to an input text field
I have an input field which has a placeholder text. I want one word
I have an input field that is rendered with a template like so: <div
I have a text field that can accept input of any kind. Based on
I have a ruby on rails application with an input text field that has
I have some text fields on my project. I want that input types of
I have following HTML code. writer input field is text filed. but I want
I have a text input field, which on DOM ready, I want to have
I have input text and I want to increase the number that is inside

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.