Bonjour, voici mon soucis :
Je consulte un fichier client. Via jquery autocomplete, j'affiche une liste de noms et à la validation, le numéro de client s'affiche. Je souhaiterais que son nom s'affiche dans le champs suivant, et c'est là que çà coince
la source getautocomplete.php
résultat avec un term = abr :
[{"value":"1","nom":"Abraham","label":"Abraham Vodel\u00e9e"},{"value":"1202","nom":"Fabri","label":"Fabri S\u00e9verine Thuin"}]
Je consulte un fichier client. Via jquery autocomplete, j'affiche une liste de noms et à la validation, le numéro de client s'affiche. Je souhaiterais que son nom s'affiche dans le champs suivant, et c'est là que çà coince

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15" />
<title>Demo</title>
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.1/themes/base/minified/jquery-ui.min.css" type="text/css" />
</head>
<body>
<?PHP
include ("./include/mes_fonctions.php");
open_db();
if ( !isset($_PUT['no_cli']) )
{
$no_cli='';
$nom='';
$prenom='';
}
?>
<form action='' method='put'>
<p><label>Client :</label><input type='text' name='numero' id='cherche'
value='<?PHP echo $no_cli ?>'></input></p>
<p><label>Nom :</label><input type='text' id='nom' name='nom' value='<?PHP echo $nom ?>'></input></p>
<p><label>Prénom :</label><input type='text' name='prenom' value='<?PHP echo $prenom ?>'></input></p>
</form>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="http://code.jquery.com/ui/1.10.1/jquery-ui.min.js"></script>
<script type="text/javascript">
$(function() {
dataType: 'json';
//autocomplete
$("#cherche").autocomplete({
source: "getautocomplete.php",
minLength: 3,
select : function(event, ui)
{
$('#cherche').append( ui.item.value );
$('#nom').append( ui.item.nom );
}
});
});
</script>
</body>
</html>
la source getautocomplete.php
<?php
include ("./include/mes_fonctions.php");
open_db();
$term=$_GET["term"];
$query=mysql_query("SELECT * FROM tiers where tie_nom like '%".$term."%' order by tie_nom ");
if ( ! $query )
die ('mysql_query error SELECT tiers' . mysql_error());
$json=array();
$return_json=array();
while($row=mysql_fetch_array($query))
{
/*
$json[] = $row['tie_nom'].' '.$row['tie_prenom'].' '.$row['tie_no'];
*/
$row = array_map('utf8_encode', $row);
$critere = $row['tie_nom'].' '.$row['tie_prenom'].' '.$row['tie_localite'];
$json['value'] = $row['tie_no'];
$json['nom'] = $row['tie_nom'];
$json['label'] = $critere;
array_push($return_json,$json);
}
echo json_encode($return_json);
flush();
exit;
?>
résultat avec un term = abr :
[{"value":"1","nom":"Abraham","label":"Abraham Vodel\u00e9e"},{"value":"1202","nom":"Fabri","label":"Fabri S\u00e9verine Thuin"}]