Problème avec le autosuggest

Fermé
yanaubin Messages postés 14 Date d'inscription dimanche 26 mars 2017 Statut Membre Dernière intervention 29 mars 2017 - Modifié le 29 mars 2017 à 01:44
jordane45 Messages postés 38310 Date d'inscription mercredi 22 octobre 2003 Statut Modérateur Dernière intervention 24 novembre 2024 - 29 mars 2017 à 10:16
Bonjour,

Je voudrais savoir si vous voyez un erreur puisque ces le seul autosuggest qui ne fonctionne pas, mes autres case fonctionne très bien et pourtant faire des jours que j'essaie de voir de ou peux provenir l'erreur

J'ai activé le log d'erreur et il me donne aucune erreur

<?php

include_once("../scripts/SESSION_CONNECT.php");
require_once("../scripts/functions.php");
require_once("../scripts/billingfunctions.php");

$input = strtolower($_GET['alarmCoName_xml']);
$len = strlen($input);
$limit = isset($_GET['limit']) ? (int) $_GET['limit'] : 0;

if ($len)
{
$getAllAlarmCoSQL = "SELECT * FROM client WHERE isAlarmCo = '1'";
$getAllAlarmCoResult = mysql_query($getAllAlarmCoSQL) or die('Query failed[getAllAlarmCoSQL]: ' . mysql_error());
$getAllAlarmCoNumOfRows = mysql_num_rows($getAllAlarmCoResult);
$AlarmCoCount = $getAllAlarmCoNumOfRows;

for ($i = 0; $i < $getAllAlarmCoNumOfRows; $i++)
{
if (strtolower(substr(mysql_result($getAllAlarmCoResult,$i,"name"),0,$len)) == $input)
{
$AlarmCoCount++;
$sqlResultArray[] = array("id"=>(mysql_result($getAllAlarmCoResult,$i,"clientID")), "value"=>htmlspecialchars(mysql_result($getAllAlarmCoResult,$i,"name")), "info"=>htmlspecialchars(mysql_result($getAllAlarmCoResult,$i,"address")) );
}
else

if ($limit && $AlarmCoCount==$limit)
break;
}
}

header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified
header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header ("Pragma: no-cache"); // HTTP/1.0

header("Content-Type: text/xml");

echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\" ?><results>";
for ($i=0;$i<count($sqlResultArray);$i++)
{
echo "<rs id=\"".$sqlResultArray[$i]['id']."\" info=\"".$sqlResultArray[$i]['info']."\">".$sqlResultArray[$i]['value']."</rs>";
}
echo "</results>";
?>


ces relier a cette page ou le autosuggest apparait

<?php

require_once("scripts/SESSION_CONNECT.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>C.A.D. - Créer une alarme</title>
<link rel="stylesheet" href="css/layout.css" type="text/css"/>
<link rel="stylesheet" href="autosuggest/css/autosuggest_inquisitor.css" type="text/css" media="screen"/>
<script type="text/javascript" language="javascript" src="javascript/functions.js"></script>
<script type="text/javascript" language="javascript" src="autosuggest/js/AutoSuggest.js"></script>
<script type="text/javascript">
function saveAlarm()
{
var allClear = validation();
if (allClear)
{
return true;
}
else
{
return false;
}
}
function validation()
{
if (document.getElementById('alarmCoName_xml').value == "" || document.getElementById('thisHiddenAlarmCoID').value == "") {
alert("Veuillez spécifier la compagnie d'alarme!");
document.getElementById('alarmCoName_xml').value = "";
document.getElementById('alarmCoName_xml').focus();
return false;
}

else if (document.getElementById('clientAddress_xml').value == "" || document.getElementById('thisHiddenClientID').value == "") {
alert("Veuillez séléctionez le site!");
document.getElementById('clientAddress_xml').value = "";
document.getElementById('clientAddress_xml').focus();
return false;
}
else if (document.getElementById('alarmTypeName_xml').value == "" || document.getElementById('thisHiddenAlarmTypeID').value == "") {
alert("Veuillez séléctionez le type d'appel!");
document.getElementById('alarmTypeName_xml').value = "";
document.getElementById('alarmTypeName_xml').focus();
return false;
}
else if (document.getElementById('thisZone').value == "") {
alert("Veuillez spécifier la zone sur les lieux!");
document.getElementById('thisZone').focus();
return false;
}
else if (document.getElementById('thisOPStart').value == "") {
alert("Veuillez spécifier le nom de l'opérateur de la compagnie d'alarme!");
return false;
document.getElementById('thisOPStart').focus();
}
else
{
document.addAlarmForm.submit();
return true;
}
}
function addAlarmEmptyFields()
{
document.getElementById('alarmCoName_xml').value = "";
document.getElementById('clientAddress_xml').value = "";
document.getElementById('thisSiteAddress').value = "";
document.getElementById('alarmTypeName_xml').value = "";
document.getElementById('thisZone').value = "";
document.getElementById('thisOPStart').value = "";

//NCR fields
document.getElementById('thisMachineID').value = "";
document.getElementById('thisWorkOrder').value = "";
document.getElementById('thisTechnician').value = "";
document.getElementById('thisTechnicianPhoneNumber').value = "";
}
function CheckAlarmType(passedValue)
{
if (passedValue.value == 126)
{
document.getElementById('thisMachineID').disabled = false;
document.getElementById('thisWorkOrder').disabled = false;
document.getElementById('thisTechnician').disabled = false;
document.getElementById('thisTechnicianPhoneNumber').disabled = false;
}
else
{
//Reset the ncr fields because it isn't an NCR alarm
document.getElementById('thisMachineID').value = "";
document.getElementById('thisWorkOrder').value = "";
document.getElementById('thisTechnician').value = "";
document.getElementById('thisTechnicianPhoneNumber').value = "";

document.getElementById('thisMachineID').disabled = true;
document.getElementById('thisWorkOrder').disabled = true;
document.getElementById('thisTechnician').disabled = true;
document.getElementById('thisTechnicianPhoneNumber').disabled = true;
}
}
function place()
{
globalPlace();
updateDateTimeNow();
document.getElementById('alarmCoName_xml').focus();
}
</script>
</head>
<body onload="place()">
<div class="AddHeader1">
<label class="PageTitle">Créer alarme</label>
</div>
<br />
<form name="addAlarmForm" method="get" action="scripts/addAlarmSave.php">
<table width="98%" border="0" cellpadding="1" cellspacing="1">
<tr>
<td><b class="required">*</b>Compagnie d'Alarme:</td>
<td><input class="textSize" type="text" id="alarmCoName_xml" name="alarmCoName_xml" onblur="clearHiddenID(this, this.form.thisHiddenAlarmCoID)" tabindex="1" /></td>
</tr>
<tr>
<td><b class="required">*</b>Site:</td>
<td><input class="textSize" type="text" id="clientAddress_xml" name="clientAddress_xml" onblur="clearHiddenID(this, this.form.thisHiddenClientID)" tabindex="2" />   <input class="textSize" readonly="readonly" type="text" id="thisSelectedClientName" /></td>
</tr>
<tr>
<td>  Addresse:</td>
<td align="center"><input style="width:453px;" type="text" tabindex="3" name="thisSiteAddress" id="thisSiteAddress" tabindex="4" /></td>
</tr>
<tr>
<td><b class="required">*</b>Type:</td>
<td><input class="textSize" type="text" id="alarmTypeName_xml" name="alarmTypeName_xml" tabindex="4" onblur="CheckAlarmType(this.form.thisHiddenAlarmTypeID);clearHiddenID(this, this.form.thisHiddenAlarmTypeID);" /></td>
</tr>
<tr>
<td><b class="required">*</b>Zone:</td>
<td><input class="textSize" type="text" tabindex="5" name="thisZone" id="thisZone" onblur="Upper(this.form.thisZone)" tabindex="5"/></td>
</tr>
<tr>
<td><b class="required">*</b>Opérateur initial:</td>
<td><input class="textSize" type="text" tabindex="6" name="thisOPStart" id="thisOPStart" onblur="Upper(this.form.thisOPStart)" tabindex="6"/></td>
</tr>
<tr>
<td>  Notes:</td>
<td><input class="textSize" type="text" tabindex="7" name="thisAlarmMessage" id="thisAlarmMessage" tabindex="7" /></td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td colspan="2" class="td_alarmViewLabel" style="text-align: center;">Champs NCR</td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td><b class="required">*</b>MachineID:</td>
<td><input class="textSize" type="text" disabled="disabled" tabindex="8" name="thisMachineID" id="thisMachineID" onblur="Upper(this.form.thisMachineID)" tabindex="7"/></td>
</tr>
<tr>
<td><b class="required">*</b>Bon de commande:</td>
<td><input class="textSize" type="text" disabled="disabled" tabindex="9" name="thisWorkOrder" id="thisWorkOrder" onblur="Upper(this.form.thisWorkOrder)" tabindex="8"/></td>
</tr>
<tr>
<td><b class="required">*</b>Technicien:</td>
<td><input class="textSize" type="text" disabled="disabled" tabindex="10" name="thisTechnician" id="thisTechnician" onblur="Upper(this.form.thisTechnician)" tabindex="9"/></td>
</tr>
<tr>
<td><b class="required">*</b>Téléphone:</td>
<td><input class="textSize" type="text" disabled="disabled" tabindex="11" name="thisTechnicianPhoneNumber" id="thisTechnicianPhoneNumber" onblur="Upper(this.form.thisTechnicianPhoneNumber)" tabindex="10"/></td>
</tr>
</table>
<br/>
<b class="required"> * Champs obligatoire!</b>
<br/>
<br/>
<a class="MenuButton" href="#" rel="nofollow noopener noreferrer" target="_blank" onClick="saveAlarm();return false;" tabindex="12">Sauvegarder</a>  
<a class="MenuButton" href="#" rel="nofollow noopener noreferrer" target="_blank" onclick="self.close()" tabindex="13">Annuler / Fermer</a>  
<a class="MenuButton" href="#" rel="nofollow noopener noreferrer" target="_blank" onClick="addAlarmEmptyFields()" tabindex="14">Vider Champs</a>                  
<a class="MenuButton" href="#" rel="nofollow noopener noreferrer" target="_blank" onClick="popUp('addClient.php?thisInsertType=quickInsert', 'console', 1024, 768, 'quickAddClientWin');" tabindex="15">Nouveau Client</a>
<br/>
<br/>

<!-- this saves certain values as -->
<input type="hidden" name="thisHiddenAlarmCoID" id="thisHiddenAlarmCoID"/>
<input type="hidden" name="thisHiddenClientID" id="thisHiddenClientID"/>
<input type="hidden" name="thisHiddenAlarmTypeID" id="thisHiddenAlarmTypeID"/>
<input type="hidden" name="thisHiddenOriginalSiteAddress" id="thisHiddenOriginalSiteAddress"/>
<input type="hidden" name="thisHiddenSelectedSiteStatus" id="thisHiddenSelectedSiteStatus"/>

<div class="alarmEditFooter">
<?php include("footer.php"); ?>
</div>
</form>
<script type="text/javascript">
var clientAddress_options_xml = {
script: function (input) { return "autosuggest/clientAddress.php?clientAddress_xml="+input+"&siteAsClientID="+document.getElementById('thisHiddenClientID').value; },
callback: function (obj) { document.getElementById('thisHiddenClientID').value = obj.id, document.getElementById('thisSelectedClientName').value = obj.info; },
varname:"input",
maxentries: 15
};
var alarmCentralName_options_xml = {
script: function (input) { return "autosuggest/alarmCoName.php?alarmCoName_xml="+input+"&alarmCoAsClientID="+document.getElementById('thisHiddenAlarmCoID').value; },
callback: function (obj) { document.getElementById('thisHiddenAlarmCoID').value = obj.id; },
varname:"input"
};
var alarmTypeName_options_xml = {
script: function (input) { return "autosuggest/alarmTypeName.php?alarmTypeName_xml="+input+"&alarmTypeID="+document.getElementById('thisHiddenAlarmTypeID').value; },
callback: function (obj) { document.getElementById('thisHiddenAlarmTypeID').value = obj.id; },
varname:"input"
};
var as_xml = new bsn.AutoSuggest('clientAddress_xml', clientAddress_options_xml);
var as_xml = new bsn.AutoSuggest('alarmCoName_xml', alarmCentralName_options_xml);
var as_xml = new bsn.AutoSuggest('alarmTypeName_xml', alarmTypeName_options_xml);
</script>
</body>
</html>


1 réponse

jordane45 Messages postés 38310 Date d'inscription mercredi 22 octobre 2003 Statut Modérateur Dernière intervention 24 novembre 2024 4 705
29 mars 2017 à 10:16
Bonjour,

Pour commencer.... as tu regardé dans la console de ton navigateur si des erreurs apparaissent ?
Au pire, ajoute un peu de log (via des console.log ) dans la partie JS de ton code.
Teste aussi ta requête en direct dans ta BDD.

0