Source for file Page.php
Documentation is available at Page.php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
* Class representing a page of a multipage form.
* LICENSE: This source file is subject to version 3.01 of the PHP license
* that is available through the world-wide-web at the following URI:
* http://www.php.net/license/3_01.txt If you did not receive a copy of
* the PHP License and are unable to obtain it through the web, please
* send a note to license@php.net so we can mail you a copy immediately.
* @package HTML_QuickForm_Controller
* @author Alexey Borzov <avb@php.net>
* @author Bertrand Mansion <bmansion@mamasam.com>
* @copyright 2003-2007 The PHP Group
* @license http://www.php.net/license/3_01.txt PHP License 3.01
* @version CVS: $Id: Page.php,v 1.7 2007/05/18 09:34:18 avb Exp $
* @link http://pear.php.net/package/HTML_QuickForm_Controller
* Create, validate and process HTML forms
require_once 'HTML/QuickForm.php';
* Class representing a page of a multipage form.
* Generally you'll need to subclass this and define your buildForm()
* method that will build the form. While it is also possible to instantiate
* this class and build the form manually, this is not the recommended way.
* @package HTML_QuickForm_Controller
* @author Alexey Borzov <avb@php.net>
* @author Bertrand Mansion <bmansion@mamasam.com>
* @version Release: 1.0.9
* Contains the mapping of actions to corresponding HTML_QuickForm_Action objects
* Contains a reference to a Controller object containing this page
* @var HTML_QuickForm_Controller
* Should be set to true on first call to buildForm()
$this->HTML_QuickForm ($formName, $method, '', $target, $attributes);
* Registers a handler for a specific action.
* @param string name of the action
* @param HTML_QuickForm_Action the handler for the action
$this->_actions[$actionName] = & $action;
* If an Action object was not registered here, controller's handle()
* @param string Name of the action
if (isset ($this->_actions[$actionName])) {
return $this->_actions[$actionName]->perform ($this, $actionName);
* Returns a name for a submit button that will invoke a specific action.
* @param string Name of the action
* @return string "name" attribute for a submit button
return '_qf_' . $this->getAttribute ('id') . '_' . $actionName;
* Loads the submit values from the array.
* The method is NOT intended for general usage.
* @param array 'submit' values
$this->_flagSubmitted = true;
$this->_submitValues = $values;
$this->_elements[$key]->onQuickFormEvent ('updateValue', null , $this);
* You should override this method when you subclass HTML_QuickForm_Page,
* it should contain all the necessary addElement(), applyFilter(), addRule()
* and possibly setDefaults() and setConstants() calls. The method will be
* called on demand, so please be sure to set $_formBuilt property to true to
* assure that the method works only once.
$this->_formBuilt = true;
* Checks whether the form was already built.
return $this->_formBuilt;
* Sets the default action invoked on page-form submit
* This is necessary as the user may just press Enter instead of
* clicking one of the named submit buttons and then no action name will
* be passed to the script.
* @param string default action name
if ($this->elementExists ('_qf_default')) {
$element = & $this->getElement ('_qf_default');
$element->setValue ($this->getAttribute ('id') . ':' . $actionName);
$this->addElement ('hidden', '_qf_default', $this->getAttribute ('id') . ':' . $actionName);
* Returns 'safe' elements' values
* @param mixed Array/string of element names, whose values we want. If not set then return all elements.
* @param bool Whether to remove internal (_qf_...) values from the resultant array
function exportValues($elementList = null , $filterInternal = false )
$values = parent ::exportValues ($elementList);
if (0 === strpos($key, '_qf_')) {
Documentation generated on Tue, 22 Jul 2008 08:00:07 -0400 by phpDocumentor 1.4.0. PEAR Logo Copyright © PHP Group 2004.
|