Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Brett James on Dec 19, 2008 19:21
open dhtmlx forum
dhtmlxCombo: Firefox incorrect XML

I've been trying to get your autosuggest comboBox working in a PHP website. Works on IE (no help), but not on Firefox. Using the most basic script I can:

function make_searchbox() {
// load libraries
$html = '<script src="'.$_SESSION['base_path'].'libraries/dhtmlxcommon.js"></script>';
$html .= '<script src="'.$_SESSION['base_path'].'libraries/dhtmlxcombo.js"></script>';
$html .= '<link rel="STYLESHEET" type="text/css" href="'.$_SESSION['base_path'].'styles/dhtmlxcombo.css">';

$html .='<div id="combo_zone" style="width:200px; height:30px;"></div>';
$html .='<script>';
$html .= '    window.dhx_globalImgPath="'.$_SESSION['base_path'].'images/dhtmlx/";';
$html .= 'var z=new dhtmlXCombo("combo_zone","alfa",200);';
$html .= 'z.enableFilteringMode(true,"'.$_SESSION['base_path'].'libraries/quicklist_return.php",true,true);';
$html .='</script>';

return $html;
}


with quicklist.php being:

<?php
header("Content-type: text/xml");
$html = '<?xml version="1.0" encoding="ISO-8859-1" ?>';
$html .='<complete add="true">';
$html .='<option value="1">one</option>';
print($html);
?>

I can see in Firebug that the headers are returning without any spaces before the XML tag:
<?xml version="1.0" encoding="ISO-8859-1" ?><complete add="true"><option value="1">one</option>

I've tried it with and without header call, with longer lists, with and without the encoding statement


Thanks.
Answer posted by Support on Dec 20, 2008 01:51
a) quicklist.php miss ending </complete> tag
b) the complete@add necessary only if you want to add returned value to the existing list

Please check attached sample
Attachments (1)
Answer posted by Brett the James on Dec 23, 2008 10:25

Thanks, that got it. I'm posting a complete test php test file, since you don't have one on your site:

<?php
header("Content-type: text/xml");
$html = '<?xml version="1.0" encoding="ISO-8859-1" ?>';
$html .='<complete add="true">';
$html .='<option value="1">one</option>';
$html .='<option value="2">two</option>';
$html .='<option value="3">three</option>';
$html .='<option value="4">four</option>';
$html .='<option value="5">five</option>';
$html .='<option value="6">six</option>';
$html .='<option value="7">seven</option>';
$html .='<option value="8">eight</option>';
$html .='<option value="9">nine</option>';
$html .='<option value="10">ten</option>';
$html .='</complete>';
 
 print($html);
 
?>