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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:03:03+00:00 2026-05-25T15:03:03+00:00

I’m not very much into js and programing in general, but I’m very stuck

  • 0

I’m not very much into js and programing in general, but I’m very stuck on something that really shouldn’t be too difficult. Feel free to visit the test page:

[REMOVED LINK]

I have three autocomplete fields: Current club, nation and career stats.
Autocomplete works perfectly for the career stats where I can also add fields and the autocomplete also works for the added field.

But for the current club and nation fields, I get results while typing but when I click the correct output it doesn’t show up in the input-field.

I can make it work using other js-libraries, but then it no longer work for the add-button career stats fields.

I use the following libraries:

<script  type="text/javascript" src="js/jquery-1.6.3.js"></script>
<script  type="text/javascript" src="js/jquery-ui-1.8.14.custom.min.js"></script>
<script  type="text/javascript" src="js/jq-ac-script.js"></script>

The current club html looks like:

<p>
    Current club <label>:</label>
    <input type="text" id="currentclub" />
</p>

In the custom made jq-ac-script.js (I originally found this somewhere online – don’t remember where) the important part is:

$(document).ready(function(){
    $( "#currentclub" ).autocomplete({
        source: "get_club_list.php",
        minLength: 1    
    })
    .data( "autocomplete" )._renderItem = function( ul, item ) {
       return $( "<li></li>" )
       .data( "item.autocomplete", item )
       .append( item.currentclub )
       .appendTo( ul );
    };
});

The “get_club_list.php” looks like:

<?php
include ("dbsetup.php");

$return_arr = array();
$param = $_GET["term"];

$fetch = mysql_query("SELECT * FROM FootNews_CLUB 
    WHERE clubShortName LIKE '%$param%'");

/* Retrieve and store in array the results of the query.*/
while ($row = mysql_fetch_array($fetch, MYSQL_ASSOC)) {

    $row_array['currentclub']           = $row['clubShortName'];
    array_push( $return_arr, $row_array );
}

/* Free connection resources. */
mysql_close($conn);

/* Toss back results as json encoded array. */
echo json_encode($return_arr);

?>

Any ideas whereas to why the selected club doesn’t show up when I click it would be appriciated!!

  • 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-25T15:03:04+00:00Added an answer on May 25, 2026 at 3:03 pm

    Wow, used my php code. Cool, glad I could help.
    http://www.jensbits.com/2010/03/29/jquery-ui-autocomplete-widget-with-php-and-mysql/

    Not sure why you are using the autocomplete code with _renderItem in it. I don’t think you need it.

    Change the php code to this:

    while ($row = mysql_fetch_array($fetch, MYSQL_ASSOC)) {
    
        $row_array['currentclub']  = $row['clubShortName'];
        $row_array['value']   = $row['clubShortName'];
        array_push( $return_arr, $row_array );
    }
    

    And, the jquery to:

    $( "#currentclub" ).autocomplete({
        source: "get_club_list.php",
        minLength: 1    
    });
    

    You can read through my tutorial again but the autocomplete needs a label or value field returned. It then populates the select list and the corresponding input field with that value.

    I left in $row_array['currentclub'] = $row['clubShortName']; because I don’t know if you are grabbing that later on. If you are not, you don’t need that line either.

    Since you control the returned data and can specify a label and/or value field in the php, I don’t understand why you are using the _renderItem for any of the autocompletes.

    BTW, you should add mysql_real_escape_string to your php code for some sql injection protection: http://www.php.net/manual/en/function.mysql-real-escape-string.php

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

Sidebar

Related Questions

I have a French site that I want to parse, but am running into
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I need a function that will clean a strings' special characters. I do NOT
I want to count how many characters a certain string has in PHP, but
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I've got a string that has curly quotes in it. I'd like to replace
I am doing a simple coin flipping experiment for class that involves flipping a

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.