* @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'];
/**
* localisation stuff
*/
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',
),
),
'switch' => array(
'type' => 'Switch',
'attributes' => array(
'required' => 'yes',
'display' => 'yes',
'edit' => 'yes',
'label' => 'Trigger',
'description' => 'Pull the trigger',
'title' => 'Trigger',
),
),
);
echo "Er, just some sample output to warm up...
";
echo 'E-Mail domain could not be found: ' . patI18n::dgettext( 'patForms', 'E-Mail domain could not be found.' ) . "
\n";
echo 'A choice is required, please select an option from the list: ' . patI18n::dgettext( 'patForms', 'A choice is required, please select an option from the list.' ) . "
\n";
echo "
";
// 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();
?>