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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T13:34:00+00:00 2026-05-13T13:34:00+00:00

I call the autocomplete jquery with the result of a GET request. The autocomplete

  • 0

I call the autocomplete jquery with the result of a GET request.
The autocomplete function call looks like this:

$('#id_project_owner_externally').autocomplete('/pm/contact_autocomplete');

The url /pm/contact_autocomplete returns a list of tuples. The first part of the tuple is the name of the contact and the second part of the tuple is the id of the contact.

The corresponding function (part of a django view) looks like this:

def iter_results(results):
        if results:
            for r in results:
                yield '%s|%s\n' % (r.first_name, r.id)

Now I’m wondering what jquery autocomplete is doing with the first_name + id tuple. Acutally the first_name is put into the input field. But what happens with the id part. This is the important information that I need.

Can I tell jquery that the id should be placed into a certain hidden field?

link to js source

Edit: The solution

<script type="text/javascript"><!--//
        $('#id_project_manager_externally').autocomplete('/pm/contact_autocomplete').result(function(event, item) {$('#id_project_manager_externally_hidden').attr("value", item[1]);});//--></script> 
  • 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-13T13:34:00+00:00Added an answer on May 13, 2026 at 1:34 pm

    The plugin docs have this example:

    var data = [ {text:'Link A', url:'/page1'}, {text:'Link B', url: '/page2'} ];
    $("...").autocomplete(data, {
      formatItem: function(item) {
        return item.text;
      }
    }).result(function(event, item) {
      location.href = item.url;
    });
    

    So you basically can have a .result() option that you use to populate a hidden field.
    e.g. $('#my_hidden_field').val(item.extra_value);

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

Sidebar

Related Questions

Below is the JS (jQuery) code of autocomplete's result function. You can see there's
I've got this code of autocomplete jqueryUI: .autocomplete({ source: function( request, response ) {
I call my JavaScript function. Why do I sometimes get the error 'myFunction is
Here's my issue : using an autocomplete jQuery plugin, I'd like to avoid multiple
I am using this JQuery autocomplete plugin . It works, and it's simple. But
I have a Jquery autocomplete ajax function whose source is calculated from code behind.
Trying to get jquery AutoComplete to return and populate it's dropdown. The input and
would love your thoughts on this one. I am using jQuery autocomplete in a
I'm trying to get a jQuery autocomplete instance to open on the textbox focus,
I have followed this tutorial which uses jQuery UI to generate Facebook tokens like:

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.