Advertisement
cheche338

Test Xajax

Jul 30th, 2013
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 2.05 KB | None | 0 0
  1. <?php
  2. require_once( "../xajax_core/xajax.inc.php" );
  3.  
  4. function testForm( $formData )
  5. {
  6.    $objResponse=new xajaxResponse();
  7.    $salida=$formData['textInput'];
  8.      $objResponse->alert( "formData: " . print_r( $formData, true ) );
  9.     $objResponse->assign( "submittedDiv", "innerHTML", $salida);
  10.     return $objResponse;
  11. }
  12.  
  13. $xajax=new xajax();
  14. //$xajax->configure("debug", true);
  15. $xajax->register(XAJAX_FUNCTION, "testForm");
  16. $xajax->processRequest();
  17. $xajax->configure('javascript URI','../');
  18.  
  19. ?>
  20.  
  21. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  22.    "http://www.w3.org/TR/2000/REC-xhtml1-20000126/DTD/xhtml1-transitional.dtd">
  23. <html xmlns = "http://www.w3.org/1999/xhtml">
  24.     <head>
  25.         <title>Form Submission Test| xajax Tests</title>
  26.  
  27.         <style type = "text/css">
  28.             fieldset > div
  29.                 {
  30.                 border: 1px solid gray;
  31.                 padding: 5px;
  32.                 background-color: white;
  33.                 }
  34.         </style>
  35.  
  36.         <?php $xajax->printJavascript( "../" ) ?>
  37.     </head>
  38.  
  39.     <body>
  40.         <h2><a href = "index.php">xajax Tests</a></h2>
  41.  
  42.         <h1>Form Submission Test</h1>
  43.  
  44.         <div>
  45.             <form id = "testForm1" onsubmit = "return false;">
  46.                 <fieldset style = "display:inline; background-color: rgb(230,230,230);">
  47.                     <legend>
  48.                         Test Form
  49.                     </legend>
  50.  
  51.                     <div style = "margin: 3px;">
  52.                         <div>
  53.                             Text Input
  54.                         </div>
  55.  
  56.                         <input type = "text" id = "textInput" name = "textInput" value = "text" />
  57.                     </div>
  58.  
  59.    
  60.  
  61.                     <input type = "submit" value = "submit through xajax"
  62.                        onclick = "xajax_testForm(xajax.getFormValues('testForm1')); return false;" />
  63.                 </fieldset>
  64.             </form>
  65.         </div>
  66.  
  67.         <div id = "submittedDiv" style = " margin: 3px;">
  68.         </div>
  69.     </body>
  70. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement