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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T17:30:54+00:00 2026-05-13T17:30:54+00:00

Okay, I have been messing with this autocomplete stuff for 2 weeks now, and

  • 0

Okay, I have been messing with this autocomplete stuff for 2 weeks now, and it’s starting to give me a headache! I’ve gotten it to do almost everything I need, but I’m hung up on one issue. I have two autocomplete text inputs that are tied together. The first input allows the user to select a person from a MySQL database table. Then, based on that selection, the second input allows the user to select one of the person’s addresses from an addresses database table. This part all works fine.

The problematic autocomplete field queries an addresses table and stores each result in an array slot as follows:

title|street_address|city|state|zip

The trouble comes when simply trying to output the selected item’s data to the innerHTML of a SPAN tag.

I’ve used the formatItem option to only display the title in the autocomplete list. Upon selecting the item I want it to then show the street_address, city, state and zip in a SPAN tag below the input box. It’s getting the information, but since the formatItem function automatically reads through every row, it is displaying the street_address, city, state and zip of the last item in the list instead of the one that is selected. However, what is returned to the text input is the title of the selected item. It’s very frustrating!

Does anyone know how I can get this issue sorted out???

Thanks in advance 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-05-13T17:30:54+00:00Added an answer on May 13, 2026 at 5:30 pm

    I’m assuming you’re using http://code.google.com/p/jquery-autocomplete/ or one of the variants. What you need to do is attach an event to onItemSelect.
    In older versions you’d get the LI element and an optional extra array of data.
    In the most recent version (after the rewrite), you get the standard value and optional data response.
    If you’re confused, just start out with this setting (assuming Firebug or othe provider of console.log):

    ...
    onItemSelect = function(a, b) { console.log(a); console.log(b); }
    ...
    

    This will show you the response of the version you are using. You can work from there.

    Let me know if you can get it to work. If you run into problems, I’ll write a more complete example.

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

Sidebar

Related Questions

Okay I have been trying to get this to work for some time now.
Okay so basically, i have been trying this for and hour or 2 now.
Okay I am newer to python and have been researching this problem but I
Okay I have been working on this for about 2 hours and am sure
Okay, this has been absolutely infuriating to debug, I have finally figured out what
Okay guys I have a database I have been working on for days now.
Okay, i know there have been some questions about this before, but I just
Okay, I have been messing around with different sorting algorithms in Ruby; mainly variations
Okay, I have been researching on how to do this, but say I am
Okay this one has me stumped.. mainly because i have been working on this

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.