Solved

No response processor error in multiple drop down menu PHP script

Posted on 2008-09-30
3
1,504 Views
Last Modified: 2010-04-21
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/xajax.inc.php');

$xajax = new xajax();
$xajax->configure('debug',true);
$xajax->configure('javascript URI', '../../xajax/');
 
class myXajaxResponse extends xajaxResponse {
 
  function addCreateOptions($sSelectId, $options) {
    $this->script("document.getElementById('".$sSelectId."').length=0");
    if (sizeof($options) >0) {
       foreach ($options as $key => $value) {
         $this->script("addOption('".$sSelectId."','".$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_qryMfg['mfg_name'];
      } 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_id']][$row_qryMake['model_id']]=$row_qryMake['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->addCreateOptions($selectId, $data);
            return $objResponse;
      }

      $xajax->register(XAJAX_FUNCTION,'addModels');
      $xajax->processRequest();

----------------

<?php
$xajax->printJavascript();
?>
<script type="text/javascript">
  function addOption(selectId, val, txt) {
    var objOption = new Option(txt, val);
     document.getElementById(selectId).options.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:</td>
                <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.
0
Comment
Question by:Computer_Dilo
  • 2
3 Comments
 
LVL 25

Accepted Solution

by:
Marcus Bointon earned 500 total points
ID: 22612418
> I have firebug installed but have no idea how to see what xajax is sending.

Well it's probably best to sort that out first. When you are viewing the page, click the firebug icon, and enable network and scripting debugging for your site. Then you'll need to refresh the page. After that, whenever you make an ajax request, it will be listed on the firebug console, and if you click the disclosure triangle on it, you'll be able to see the original request, and be able to reload the response.

Obviously the request should look like it's asking for the right stuff and the response should contain what you expect it to.
0
 

Author Comment

by:Computer_Dilo
ID: 22612444
You think I could find that information anywhere :(

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.
0
 

Author Closing Comment

by:Computer_Dilo
ID: 31501593
I have switched to Ajax instead after messing around. Cheers for help!
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This article discusses four methods for overlaying images in a container on a web page
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question