* @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']; /** * internationalisaion */ require_once $neededFiles['patI18n']; // Internal $moduleConf = array(); patI18n::addModule( 'Internal', $moduleConf ); // Gettext $moduleConf = array( 'domain' => 'this_domain_is_not_used', 'dir' => '/tmp', 'domains' => array( array( 'domain' => 'patForms', 'dir' => dirname( __FILE__ ) . '/locales', ) ) ); patI18n::addModule( 'Gettext', $moduleConf ); patI18n::setLocale( $_GET['lang'] ); // all the above is done by the following include // require_once $neededFiles['patI18n_configure']; // 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', ), ), ); // 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(); ?>