Computer_Dilo
asked on
No response processor error in multiple drop down menu PHP script
I keep getting "ERROR: No response processor is available to process the response from the server." when trying to use xajax to create a PHP coded page where one drop down menu in a form determines the content of the second which determines the content of a third. These are the relevant code snippets...
require('/home/xajax/xajax _core/xaja x.inc.php' );
$xajax = new xajax();
$xajax->configure('debug', true);
$xajax->configure('javascr ipt URI', '../../xajax/');
class myXajaxResponse extends xajaxResponse {
function addCreateOptions($sSelectI d, $options) {
$this->script("document.ge tElementBy Id('".$sSe lectId."') .length=0" );
if (sizeof($options) >0) {
foreach ($options as $key => $value) {
$this->script("addOption(' ".$sSelect Id."','".$ value."',' ".$key."') ;");
}
}
}
}
------------
mysql_select_db($database_ Climax, $Climax);
$query = "SELECT Manufacturer.mfg_id, Manufacturer.mfg_name FROM Manufacturer ORDER BY Manufacturer.mfg_name";
$qryMfg = mysql_query($query, $Climax) or die(mysql_error());
$row_qryMfg = mysql_fetch_assoc($qryMfg) ;
$mfg = array();
do {
$mfg[$row_qryMfg['mfg_id'] ]=$row_qry Mfg['mfg_n ame'];
} while ($row_qryMfg = mysql_fetch_assoc($qryMfg) );
mysql_free_result($qryMfg) ;
$query = "SELECT Model.mfg_id, Model.model_id, Model.model_name FROM Model ORDER BY Model.model_name";
$qryMake = mysql_query($query, $Climax) or die(mysql_error());
$row_qryMake = mysql_fetch_assoc($qryMake );
$totalRows_qryMake = mysql_num_rows($qryMake);
$model = array();
do {
$model[$row_qryMake['mfg_i d']][$row_ qryMake['m odel_id']] =$row_qryM ake['model _name'];
} while ($row_qryMake = mysql_fetch_assoc($qryMake ));
mysql_free_result($qryMake );
-----------
// adds options to the drop down menus dependent on previous choices
function addModels($selectId, $mode) {
global $model;
$objResponse = new myXajaxResponse();
$data = $model[$mode];
$objResponse->addCreateOpt ions($sele ctId, $data);
return $objResponse;
}
$xajax->register(XAJAX_FUN CTION,'add Models');
$xajax->processRequest();
----------------
<?php
$xajax->printJavascript();
?>
<script type="text/javascript">
function addOption(selectId, val, txt) {
var objOption = new Option(txt, val);
document.getElementById(se lectId).op tions.add( objOption) ;
}
</script>
---------------
<tr>
<td width="80" class="formtxt1">Make:</td >
<td><select name="cbMake" class="formbox1" id="cbMake" onchange="xajax_addModels( 'cbModel', document.catsearch.cbMake. value)">
<option value="0" selected>All</option>
<?php
foreach ($mfg as $key => $value) {
?>
<option value="<?php echo $key?>"><?php echo $value?></option>-->
<?php
}
?>
</select>
</td>
</tr>
<tr>
<td class="formtxt1">Model:</t d>
<td>
<select name="cbModel" class="formbox1" id="cbModel">
<option value="0" selected>All</option>
</select></td>
</tr>
I have firebug installed but have no idea how to see what xajax is sending.
require('/home/xajax/xajax
$xajax = new xajax();
$xajax->configure('debug',
$xajax->configure('javascr
class myXajaxResponse extends xajaxResponse {
function addCreateOptions($sSelectI
$this->script("document.ge
if (sizeof($options) >0) {
foreach ($options as $key => $value) {
$this->script("addOption('
}
}
}
}
------------
mysql_select_db($database_
$query = "SELECT Manufacturer.mfg_id, Manufacturer.mfg_name FROM Manufacturer ORDER BY Manufacturer.mfg_name";
$qryMfg = mysql_query($query, $Climax) or die(mysql_error());
$row_qryMfg = mysql_fetch_assoc($qryMfg)
$mfg = array();
do {
$mfg[$row_qryMfg['mfg_id']
} while ($row_qryMfg = mysql_fetch_assoc($qryMfg)
mysql_free_result($qryMfg)
$query = "SELECT Model.mfg_id, Model.model_id, Model.model_name FROM Model ORDER BY Model.model_name";
$qryMake = mysql_query($query, $Climax) or die(mysql_error());
$row_qryMake = mysql_fetch_assoc($qryMake
$totalRows_qryMake = mysql_num_rows($qryMake);
$model = array();
do {
$model[$row_qryMake['mfg_i
} while ($row_qryMake = mysql_fetch_assoc($qryMake
mysql_free_result($qryMake
-----------
// adds options to the drop down menus dependent on previous choices
function addModels($selectId, $mode) {
global $model;
$objResponse = new myXajaxResponse();
$data = $model[$mode];
$objResponse->addCreateOpt
return $objResponse;
}
$xajax->register(XAJAX_FUN
$xajax->processRequest();
----------------
<?php
$xajax->printJavascript();
?>
<script type="text/javascript">
function addOption(selectId, val, txt) {
var objOption = new Option(txt, val);
document.getElementById(se
}
</script>
---------------
<tr>
<td width="80" class="formtxt1">Make:</td
<td><select name="cbMake" class="formbox1" id="cbMake" onchange="xajax_addModels(
<option value="0" selected>All</option>
<?php
foreach ($mfg as $key => $value) {
?>
<option value="<?php echo $key?>"><?php echo $value?></option>-->
<?php
}
?>
</select>
</td>
</tr>
<tr>
<td class="formtxt1">Model:</t
<td>
<select name="cbModel" class="formbox1" id="cbModel">
<option value="0" selected>All</option>
</select></td>
</tr>
I have firebug installed but have no idea how to see what xajax is sending.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I have switched to Ajax instead after messing around. Cheers for help!
ASKER
Thank you!
I'll have a look asap - I've actually got the squirts and just gone to a PHP refresh instead to get the thing going.