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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:24:49+00:00 2026-06-17T12:24:49+00:00

I need your help on the issue below. I’m trying to set a Input

  • 0

I need your help on the issue below.

I’m trying to set a Input Hidden value using jQuery AutoComplete function, but the value is not being passed (ui.item.bank_id is undefined).

Javascript code:

$("#reg_bank").autocomplete({  
    //define callback to format results  
    source: function(req, add){  
        //pass request to server  
      $.getJSON("/get_banks.php?callback=?", { q:req.term }, function(data) {  
        //create array for response objects  
        var suggestions = [];  
        //process response  
        $.each(data, function(i, val){  
            suggestions.push(val.bank_name+"("+val.bank_id+")");  
         });  
         //pass array to callback  
         add(suggestions);  
      });  
    },  
    select: function(e, ui) {  
        alert(ui.item.bank_id);
        //$('#reg_bank_id').val(ui.item.bank_id); 
    },   
    change: function() {   
    }  
  }); 

For some reason I can’t figure it out, the ui.item.bank_id is undefined.

My JSON outputs something like that:
[{"bank_id":"341","bank_name":"Ita\u00fa Unibanco S.A."}]

Let me know if you need any additional info..

Thx..

  • 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-17T12:24:50+00:00Added an answer on June 17, 2026 at 12:24 pm

    I think you should adjust source function as follow

    source: function(req, add){  
        //pass request to server  
      $.getJSON("/get_banks.php?callback=?", { q:req.term }, function(data) {  
        //create array for response objects  
        var suggestions = [];  
        //process response  
        $.each(data, function(i, val){  
            suggestions.push({'label':val.bank_name, 'value':val.bank_id});  
         });  
         //pass array to callback  
         add(suggestions);  
         // now suggestions is arrays of object with 'label' and 'value' properties
      });  
    }
    

    and select function as follow

    select: function(e, ui) {  
      alert(ui.item.value); // will get bank_id
      alert(ui.item.label); // will get bank_name
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need your help again :) I'm trying to do a plugin with jQuery
I need your help in this particular issue I want to pass the value
Please i need your help with a small issue i'm having. I'm using the
I need your help with my script. What I'm trying t do is insert
I need your help. I'm trying to install php_apc.dll into my php directory. So
I am fetching some value from another page using jQuery .get() like this <input
Below is my HTML code, I need your help to solve 2 issues, I
I need your help on one practical issue. I have created a WCF service
I am having a data conversion issue that need your help. My project is
I need your help. I have this javascript function to write a message to

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.