Source for file Page.php
Documentation is available at Page.php
/* vim: set expandtab tabstop=4 shiftwidth=4: */
// +----------------------------------------------------------------------+
// +----------------------------------------------------------------------+
// | Copyright (c) 1997-2003 The PHP Group |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.0 of the PHP license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available at through the world-wide-web at |
// | http://www.php.net/license/2_02.txt. |
// | If you did not receive a copy of the PHP license and are unable to |
// | obtain it through the world-wide-web, please send a note to |
// | license@php.net so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// | Authors: Alexey Borzov <avb@php.net> |
// | Bertrand Mansion <bmansion@mamasam.com> |
// +----------------------------------------------------------------------+
// $Id: Page.php 6184 2005-09-07 10:08:17Z bmol $
require_once 'HTML/QuickForm.php';
* The class represents 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.
* @author Alexey Borzov <avb@php.net>
* @package HTML_QuickForm_Controller
* @version $Revision: 6184 $
* Contains the mapping of actions to corresponding HTML_QuickForm_Action objects
* Contains a reference to a Controller object containing this page
* @var object HTML_QuickForm_Controller
* Should be set to true on first call to buildForm()
function HTML_QuickForm_Page($formName, $method = 'post', $target = '_self', $attributes = null)
* Registers a handler for a specific action.
* @param string name of the action
* @param object 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->_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.
* Checks whether the form was already built.
* 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
$element->setValue($this->getAttribute('id') . ':' . $actionName);
|