Advertisement
edrobinson

Untitled

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