Hi,

I was wondering if this is a known bug or a missing feature if I have
multiple input fields with Autocomplete attached to them.

I have on one page about 10 text input fields and they all have
autocomplete code for them. 8 of them call the same script, and 2 of
them call another script.

In firebug, I get the result back from those scripts, but the drop-
down does not appear. Bellow I'll post the backend script and the js
script for one field, the other ones being identical.

Backend script

<?php
header("Content-type: text/xml");
$sql = mysql_connect("localhost", "root", "satnet?");
mysql_select_db("stoc", $sql);
        $xml = "";
        if(isset($_REQUEST['value'])) {
                $queryString = trim($_REQUEST['value']);
                if(strlen($queryString) >0) {
                        $query = mysql_query("SELECT `cod_produs`,`nume_produs` 
FROM
`produse` WHERE `nume_produs` LIKE '".$queryString."%' LIMIT 0,20");
                        $xml.="<?xml version=\"1.0\"?>\n";
                        $xml.="<ajaxresponse>\n";
                        while($data = mysql_fetch_array($query)){
                $xml.="   <item>\n";
                $xml.="      <text><![CDATA[<strong>".
$data["nume_produs"]."</strong>]]></text>\n";
                $xml.="      <value><![CDATA[".
$data["nume_produs"]."]]></value>\n";
                  $xml.="      
<cod><![CDATA[".$data["cod_produs"]."]]></cod>\n";
                $xml.="   </item>\n";
            }
                    $xml.="</ajaxresponse>\n";
                    echo $xml;
                }
        }
?>

js code

$(document).ready(function(){
$('#produs_1').Autocomplete({
                source: 'includes/html/produse_ajax.php',
                delay: 120,
                fx: {
                        type: 'slide',
                        duration: 150
                },
                autofill: false,
                helperClass: 'autocompleter',
                selectClass: 'selectAutocompleter',
                minchars: 2,
                onShow : fadeInSuggestion,
                onHide : fadeOutSuggestion
        });
});

Help is very appreciated. Thanks

Reply via email to