Solved

No response processor error in multiple drop down menu PHP script

Posted on 2008-09-30
3
1,487 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:
Squinky earned 500 total points
Comment Utility
> 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
Comment Utility
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
Comment Utility
I have switched to Ajax instead after messing around. Cheers for help!
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Introduction Many web sites contain image galleries; a common design for these galleries includes a page with a collection of thumbnail images.  You can click on each of the thumbnail images to see the larger version of the image.  This is easily i…
Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

743 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now