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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T06:33:04+00:00 2026-06-03T06:33:04+00:00

I am using the jQuery autocomplete (http://jqueryui.com/demos/autocomplete/) and have it working but when a

  • 0

I am using the jQuery autocomplete (http://jqueryui.com/demos/autocomplete/) and have it working but when a user selects an item it then places the value in the text box. I would like it so that when the user selects an item the label is used as the text in the textbox and the value is inserted in a hidden field ‘cId’.

I’ve had a look around and can seem to find a solution.

My values are in a string called ClientCsv like:

[ { label: "ClientId1", value: "ClientName1" }, { label: "ClientId2", value: "ClientName2" } ]

The jquery I currently use is:

$(function () {
var availableTags = [ " & ClientCsv() & " ]; $('#tags').autocomplete({ source: availableTags});
});

Form code:

<asp:TextBox ID="tags" runat="server"></asp:TextBox>
<asp:HiddenField ID="cId" runat="server" />

Thanks for any help.

  • 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-06-03T06:33:05+00:00Added an answer on June 3, 2026 at 6:33 am

    You need to wire up the select event for the autocomplete and then prevent the default action of populating the value in the search field.

    var availableTags = [{ label: "ClientId1", value: "ClientName1" }, { label: "ClientId2", value: "ClientName2"}];
    
    $(function () {
        var txt = $('#tags');
        txt.autocomplete({ 
            source: availableTags,
            select: function(event, ui){
                //put the label in your text field
                txt.val(ui.item.label);
    
                //put the value in your hidden field
                $('#cId').val(ui.item.value);
    
                //cancel the event to prevent it populating the value
                event.preventDefault();
            }
        });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using jquery autocomplete combobox , and its all working great. Visit http://jqueryui.com/demos/autocomplete/#combobox
I'm using jquery autocomplete <script src='http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js'></script> <script src='http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/jquery-ui.min.js'></script> Everything is working Ok., but now
Im trying to implement an asp.net textbox using the jQuery UI Autocomplete widget http://jqueryui.com/demos/autocomplete/#remote
I'm using the nifty 'combobox' variant of jQuery UI Autocomplete - see here: http://jqueryui.com/demos/autocomplete/#combobox
I'm using the autocombox from the jQuery UI library (http://jqueryui.com/demos/autocomplete/#combobox). The combobox is replacing
I'm using jQuery UI, specifically Datepicker and Autocomplete, as follows: <script src=http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js></script> <link href=http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css
I've got a form that uses the jquery autocomplete UI plugin, http://jqueryui.com/demos/autocomplete/ , which
I've found this hack to use jTemplates with the jQuery UI Autocomplete: http://www.shawnmclean.com/blog/2011/02/using-jqueryui-autocomplete-with-jtemplates/ but,
I'm using 'rails3-jquery-autocomplete' gem, but it doesn't have multi column search, but there is
I'm developing a form, and using jQuery UI Autocomplete. When the user selects an

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.