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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T06:41:25+00:00 2026-05-30T06:41:25+00:00

In using jQuery Autosuggest, users are able to start entering a part number and

  • 0

In using jQuery Autosuggest, users are able to start entering a part number and autosuggest shows a list of similar parts. Once a part is select, I want the description to appear in a textbox next to the part number. The part numbers and description are coming back from the CFC, but I am unable to get the part description to appear in the part description text box. how can I do this?

The form with jQuery:

<form action="index.cfm?action=reports:part.test"  method="post">
<fieldset>
    <legend>test</legend>
    <p>Start typing a part number.</p>
    <p>
        <label for="partnum">Part Number: </label>
            <input type="text" id="partnum"  name="partnum" />
            <input readonly="readonly" type="text" id="partdescription" name="partdescription" />
    </p>
    <p>
            <input type="submit" name="submit" value="Submit" />
    </p>
</fieldset>
</form>


<cfsavecontent variable="datatables_definitions">
<!-- added by user.list --> 
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
$(document).ready(function(){



        $('#partnum').autocomplete(
            {source: function(request, response) {
                $.ajax({
                    url: "/reports/services/remote/partSuggest.cfc?method=lookUpPart&returnformat=json",
                    dataType: "json",
                    data: {
                      search: request.term,
                      maxRows: 10
                    },
                    success: function(data) {
                      response(data);
                      $('#partdescription').val(partdescription);
                    },

            })
            },
            parse: function(data){
                return $.map(data, function(item) {
                    return { data: item, value: item, result: item };
                });
            }

        });
    });
</SCRIPT>
</cfsavecontent>

<cfhtmlhead text="#datatables_definitions#" />

The CFC doing the query:

<cfcomponent output="false">
    <cffunction name="lookUpPart" access="remote" returntype="any" >
        <cfargument name="search" type="any" required="false" default="">
        <cfargument name="datasource" type="string" required="no" default="myDSN">

        <!--- Define variables --->
        <cfset var data="">
        <cfset var result=ArrayNew(1)>

        <!--- Do search --->
        <cfquery name="getPart" datasource="#arguments.datasource#">
            SELECT top 20 partnum, partdescription
            FROM part
            WHERE partnum LIKE '%#trim(arguments.search)#%'
            ORDER BY partnum
        </cfquery>

        <!--- Build result array --->
        <cfloop query="getPart">
            <cfset returnStruct = StructNew() />
            <cfset returnStruct["partnum"] = partnum />
            <cfset returnStruct["partdescription"] = partdescription />
            <cfset ArrayAppend(result,returnStruct) />
        </cfloop>

        <!--- And return it --->
        <cfreturn serializeJSON(result) />
    </cffunction>
</cfcomponent>

Again, once the user successfully selects a part number from the list, I want the associated part description to appear in the partdescription box next to the part number.

Thanks.

  • 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-30T06:41:27+00:00Added an answer on May 30, 2026 at 6:41 am

    This ended up working:

    $('#partdescription').val(ui.item.partdescription);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using jQuery , how can I dynamically set the size attribute of a select
Using jQuery, is there a way to select all tag that reference a specific
I'm using this jQuery AutoSuggest Plugin. It's pretty well documented, but there is a
Using jQuery 1.6.2 HTML that I'm operating on <select id=langId> <option value=0>Argentina - Spanish</option>
Using jQuery, I'm trying to change the selected option in a SELECT element to
I using this plugin http://code.drewwilson.com/entry/autosuggest-jquery-plugin While typing MAS there is no data matched, so
I am currently using - http://code.drewwilson.com/entry/autosuggest-jquery-plugin for an autosuggest on my site. I have
I am using this http://code.drewwilson.com/entry/autosuggest-jquery-plugin Here is my html <h1>Category : </h1> &nbsp;<input type=text
I am new to jquery. I am using the below code for showing autosuggest
I'm currently using Solr with Terms Component and Jquery Autosuggest which works quiet good.

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.