Solved

No response processor error in multiple drop down menu PHP script

Posted on 2008-09-30
3
1,515 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.

752 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