* @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']; /** * patErrorManager class */ require_once $neededFiles['patErrorManager']; // element definitions for this example $elementsDefinition = array( 'username' => array( 'type' => 'String', 'attributes' => array( 'required' => 'yes', 'display' => 'yes', 'edit' => 'yes', 'label' => 'Nickname', 'description' => 'Enter your nickname here.', 'maxlength' => '5', 'minlength' => '4', 'default' => 'The Argh', 'title' => 'Username', ), ), ); echo 'Setting locale to french (fr)... validation errors '; echo 'will be displayed in french.

'; // Set the locale to french. By doing this via a static method call, // you can set it globally for all forms. Otherwise you can use this // method to set it per each form object. patForms::setLocale( 'fr' ); // create our form $form =& patForms::createForm( $elementsDefinition ); // tell the form it has been submitted $form->setSubmitted( true ); // validate the element - this will always fail here on purpose to show // the error message $form->validateForm(); // display the errors displayErrors( $form ); // see patExampleGen/customFunctions.php // EXAMPLE END ------------------------------------------------------ $exampleGen->displayFooter(); ?>