* @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( 'mammalians' => array( 'type' => 'Pool', 'attributes' => array( 'label' => 'Mammalians', 'title' => 'Mammalians', 'description' => 'List of mammals', 'size' => '10', 'style' => 'width:150px;', 'class' => 'pool', 'candidates' => array( array( 'label' => 'Ant', 'value' => 'ant', ), array( 'label' => 'Bee', 'value' => 'bee', ), array( 'label' => 'Dog', 'value' => 'deg', ), array( 'label' => 'Cat', 'value' => 'cat', ), array( 'label' => 'Shark', 'value' => 'shark', ), array( 'label' => 'Whale', 'value' => 'whale', ), ), 'candidatetitle' => 'Animals', 'membertitle' => 'Mammalians', 'titleclass' => 'pooltitle', 'tooladd' => 'add mammalian', 'toolremove' => 'remove animal', 'toolclass' => 'pooltool', ), ), 'freaks' => array( 'type' => 'Pool', 'attributes' => array( 'label' => 'Freaks', 'title' => 'Freaks', 'description' => 'List of freaks', 'class' => 'pool', 'style' => 'width:150px;', 'candidates' => array( array( 'label' => 'Sebastian Bergmann', 'value' => 1001, ), array( 'label' => 'Alexander Wirtz', 'value' => 1002, ), array( 'label' => 'Paul Hammant', 'value' => 1003, ), array( 'label' => 'Bj�n Schotte', 'value' => 1004, ), array( 'label' => 'Tobias Schlitt ', 'value' => 2004, ), array( 'label' => 'George Schlossnagl', 'value' => 3001, ), array( 'label' => 'Christian Wenz', 'value' => 4001, ), array( 'label' => 'Marc Pohl', 'value' => 5001, ), array( 'label' => 'Mark Britton', 'value' => 5002, ), array( 'label' => 'Peter Petermann', 'value' => 5003, ), array( 'label' => 'Wilko Miletic', 'value' => 5004, ), array( 'label' => 'Tobias Hauser', 'value' => 5005, ), array( 'label' => 'Geir Torstein Kristiansen', 'value' => 5006, ), array( 'label' => 'Jan Kneschke', 'value' => 5007, ), ), 'candidatetitle' => 'people', 'membertitle' => 'freaks', 'titleclass' => 'pooltitle', ), ), ); // create the form $form =& patForms::createForm( $elementsDefinition, array( 'name' => 'myForm' ) ); // create the needed renderer $renderer =& patForms::createRenderer( "Array" ); // set the renderer $form->setRenderer( $renderer ); // use auto-validation $form->setAutoValidate( 'save' ); // serialize the elements $elements = $form->renderForm(); // ERROR DISPLAY ------------------------------------------------------ // ask the form if it has been submitted and display errors. For // convenience and also to keep the examples easy to understand, all // the following examples will use teh helper methods of the examples // framework to display the errors and the form. if( $form->isSubmitted() ) { displayErrors( $form ); // see patExampleGen/customFunctions.php } // DISPLAY FORM ------------------------------------------------------ displayForm( $form, $elements ); // see patExampleGen/customFunctions.php // EXAMPLE END ------------------------------------------------------ $exampleGen->displayFooter(); ?>