displayHead( 'Example' ); require_once 'patForms.php'; require_once 'patErrorManager.php'; // 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' => 'and', ), 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', ), ), ); // create the form $form =& patForms::createForm( $elementsDefinition, array( 'name' => 'myForm' ) ); $form->setNamespace('mynamespace'); // 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(); echo '
' . wordwrap(htmlentities(print_r($form->getElement('mammalians')->serialize(), true)), 200);
?>