dokeos
[ class tree: dokeos ] [ index: dokeos ] [ all elements ]

Source for file catchAllFunctionTest.php

Documentation is available at catchAllFunctionTest.php

  1. <?php
  2. require_once("../xajax.inc.php");
  3.  
  4. function test2ndFunction($formData$objResponse)
  5. {
  6.     $objResponse->addAlert("formData: " print_r($formDatatrue));
  7.     $objResponse->addAssign("submittedDiv""innerHTML"nl2br(print_r($formDatatrue)));
  8.     return $objResponse->getXML();
  9. }
  10.  
  11. function myCatchAllFunction($funcName$args)
  12. {
  13.     $objResponse new xajaxResponse();
  14.     $objResponse->addAlert("This is from the catch all function");
  15. //    return $objResponse;
  16.     return test2ndFunction($args[0]$objResponse);
  17. }
  18.  
  19. function testForm($formData)
  20. {
  21.     $objResponse new xajaxResponse();
  22.     $objResponse->addAlert("This is from the regular function");
  23.     return test2ndFunction($formData$objResponse);
  24. }
  25. $xajax new xajax();
  26. $xajax->registerCatchAllFunction("myCatchAllFunction");
  27. //$xajax->registerFunction("testForm");
  28. $xajax->processRequests();
  29. ?>
  30. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  31.         "http://www.w3.org/TR/2000/REC-xhtml1-20000126/DTD/xhtml1-transitional.dtd">
  32. <html xmlns="http://www.w3.org/1999/xhtml">
  33. <head>
  34. <title>Catch-all Function Test | xajax Tests</title>
  35. <?php $xajax->printJavascript("../"?>
  36. </head>
  37. <body>
  38.  
  39. <h2><a href="index.php">xajax Tests</a></h2>
  40. <h1>Catch-all Function Test</h1>
  41.  
  42. <form id="testForm1" onsubmit="return false;">
  43. <p><input type="text" id="textBox1" name="textBox1" value="This is some text" /></p>
  44. <p><input type="submit" value="Submit Normal" onclick="xajax.call('testForm', [xajax.getFormValues('testForm1')]); return false;" /></p>
  45. </form>
  46.  
  47. <div id="submittedDiv"></div>
  48.  
  49. </body>
  50. </html>

Documentation generated on Thu, 12 Jun 2008 13:01:53 -0500 by phpDocumentor 1.4.1