Source for file simple.php
Documentation is available at simple.php
* Usage example for HTML_QuickForm2_Controller: simple
* @author Alexey Borzov <avb@php.net>
* @author Bertrand Mansion <php@mamasam.com>
require_once 'HTML/QuickForm2.php';
require_once 'HTML/QuickForm2/Controller.php';
// Load some default action handlers
require_once 'HTML/QuickForm2/Controller/Action/Submit.php';
require_once 'HTML/QuickForm2/Controller/Action/Display.php';
// Start the session, form-page values will be kept there
$fs = $form->addFieldset ()->setLabel ("Controller example 1: a simple form");
$fs->addText ("tstText", array ('size'=>20 , 'maxlength'=>50 ))
->setLabel ("Please enter something:")
->addRule ("required", "Pretty please!");
$fs->addSubmit ($this->getButtonName('submit'), array ('value' => 'Send'));
->setAttribute ('style', 'display:none');
public function perform(HTML_QuickForm2_Controller_Page $page, $name)
echo "Submit successful!<br>\n<pre>\n";
var_dump($page->getController ()->getValue ());
protected function renderForm(HTML_QuickForm2 $form)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
/* Set up custom font and form width */
font-family: Arial,sans-serif;
/* Use default styles included with the package */
if ('@data_dir@' != '@' . 'data_dir@') {
$filename = '@data_dir@/HTML_QuickForm2/quickform.css';
<title>HTML_QuickForm2 simple controller example</title>
$controller->addPage ($page);
Documentation generated on Wed, 10 Apr 2019 08:56:11 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|