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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T17:07:38+00:00 2026-06-13T17:07:38+00:00

I have the following for an autocomplete text box which works fine: $(‘#material_number’).autocomplete({ source:

  • 0

I have the following for an autocomplete text box which works fine:

 $('#material_number').autocomplete({
     source: function(request, response) {
         $.ajax({
             url: "index.cfm?action=leadtime.getmaterialleadtime&returnformat=json",
             dataType: "json",
             data: {
                 search: request.term,
                 maxRows: 10
             },
             success: function(data) {
                 response(data);
                 console.log();
                 //need to append material_description to a textbox here
             }
         })
     }
 });

What i am trying to to is output the material_description value returned to a textbox called txtMaterialDescription. I have looked at different examples on this site but unable to get it to work. So when the user selects a part number from the autosuggest list, the description field populates the part number description. Can anyone help me out and point me in the right direction please?

many thanks as always.

JC

  • 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-13T17:07:40+00:00Added an answer on June 13, 2026 at 5:07 pm

    You need to trap the focus or select event:

    focus: function(event, ui) {
        $("#textbox").val(ui.item.someProperty);
    }
    

    Now, if your JSON data consists of objects that look like {label: ..., value: ..., someProperty: ...} then you can write:

    source: function(request, response) {
        $.ajax({
            url: "index.cfm?action=leadtime.getmaterialleadtime&returnformat=json",
            dataType: "json",
            data: {
                search: request.term,
                maxRows: 10
            },
            success: response
        });
    }
    

    Otherwise, you can always transform your data using jQuery.map:

    source: function(request, response) {
        $.ajax({
            url: "index.cfm?action=leadtime.getmaterialleadtime&returnformat=json",
            dataType: "json",
            data: {
                search: request.term,
                maxRows: 10
            },
            success: function(data) {
                response($.map(data, function(item) {
                    return {
                        label: item.productName,
                        value: item.productCode,
                        someProperty: item.productDescription + item.productPrice
                    }
                }));
            }
        });
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following set up, a ddl (ddlProd, radBuyer) and autocomplete text box
I have an autocomplete textbox function which I am using in meteor. It works
I have the following code: $(#auto).autocomplete({ source: js/search.php, minLength: 3 }); This code is
I have the following jquery which reads from the excellent geonames.org web service: $('#<%=txtFindMyCity.ClientID%>').autocomplete(http://ws.geonames.org/searchJSON,
I have an autocomplete text box that users can type an item code into
In a text box, as you type, we have autocomplete that generates a list
:I have the following in one of my partial views: <script type=text/javascript language=javascript> $(document).ready(function
I have following source. In insertMessage(..), it calls selectMessage to check whether duplicate record
I'm struggling to understand why the following problem appears. I have an input box
I have the following plan in mind: I have a AutoComplete UI element on

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.