* @license LGPL, see license.txt for details * @link http://www.php-tools.net */ /** * Main examples prepend file, needed *only* for the examples framework! */ include_once 'patExampleGen/prepend.php'; $exampleGen->displayHead( 'Example' ); // EXAMPLE START ------------------------------------------------------ /** * main patForms class */ require_once $neededFiles['patForms']; /** * patForms parser class */ require_once $neededFiles['patForms_Parser']; /** * patErrorManager class */ require_once $neededFiles['patErrorManager']; /** * localisation stuff */ require_once $neededFiles['patI18n_configure']; function validationSuccessful($form, $event) { echo "Validation successful, method called."; } // as we do not create a parser object and just call the parser's // static methods, any needed options have to be called statically // too, like setting the namespace or the cache folder to use: patForms_Parser::setNamespace( "patForms" ); patForms_Parser::setCacheDir( "cache" ); // this method creates a complete patForms object in just one call, // by setting the renderer to use, the source form template file, // and the optional target template file. $form =& patForms_Parser::createFormFromTemplate( 'SimpleRenderer', 'templates/example_parser_events.fhtml', 'templates/example_parser_events.html' ); // use auto-validation $form->setAutoValidate('save'); // render the content into a variable, we will display it after // the validation output $content = $form->renderForm(); // check the form and display error messages if any if ($form->isSubmitted()) { displayErrors($form); // see patExampleGen/customFunctions.php } // now display the form echo $content; // EXAMPLE END ------------------------------------------------------ $exampleGen->displayFooter(); ?>