Documentation

Horde_Core_Form
in package

Horde_Core_Form Master Class.

The Horde_Core_Form:: package provides form rendering, validation, and other functionality for the Horde Application Framework.

Copyright 2001-2007 Robert E. Coyle robertecoyle@hotmail.com Copyright 2001-2017 Horde LLC (http://www.horde.org/)

See the enclosed file COPYING for license information (LGPL). If you did not receive this file, see http://www.horde.org/licenses/lgpl21.

Tags
author

Robert E. Coyle robertecoyle@hotmail.com

author

Chuck Hagenbuch chuck@horde.org

Table of Contents

$_autofilled  : mixed
$_currentSection  : mixed
$_errors  : mixed
$_help  : mixed
$_hiddenVariables  : mixed
$_name  : mixed
$_open_section  : mixed
$_sections  : mixed
$_submitted  : mixed
$_title  : mixed
$_useFormToken  : mixed
$_variables  : mixed
$_vars  : mixed
__construct()  : mixed
add()  : mixed
addHidden()  : mixed
TODO
addVariable()  : mixed
TODO
clearError()  : mixed
clearValidation()  : mixed
execute()  : mixed
getError()  : mixed
getHiddenVariables()  : mixed
getInfo()  : mixed
Fetch the field values of the submitted form.
getName()  : mixed
getOpenSection()  : mixed
getRenderer()  : object
Get the renderer for this form, either a custom renderer or the standard one.
getSectionDesc()  : mixed
getSectionExpandedState()  : mixed
getSectionImage()  : mixed
getSections()  : mixed
getTitle()  : mixed
getType()  : mixed
getVariables()  : mixed
getVars()  : mixed
hasHelp()  : mixed
insertVariableBefore()  : mixed
TODO
isSubmitted()  : bool
Determines if this form has been submitted or not. If the class var _submitted is null then it will check for the presence of the formname in the form variables.
isValid()  : mixed
onSubmit()  : mixed
Checks if there is anything to do on the submission of the form by looping through each variable's onSubmit() function.
preserve()  : mixed
Preserve the variables/values from another Horde_Core_Form object.
removeVariable()  : bool
Removes a variable from the form.
setError()  : mixed
setOpenSection()  : mixed
setSection()  : mixed
setSubmitted()  : mixed
Explicitly sets the state of the form submit.
setTitle()  : mixed
setVars()  : mixed
useToken()  : bool
Sets or gets whether the form should be verified by tokens.
validate()  : bool
Does the action of validating the form, checking if it really has been submitted by calling isSubmitted() and if true does any onSubmit() calls for var types in the form. The _submitted var is then rechecked.
_getInfoFromVariables()  : mixed
Fetch the field values from a given array of variables.

Properties

$_autofilled

protected mixed $_autofilled = alse

$_currentSection

protected mixed $_currentSection = array()

$_errors

protected mixed $_errors = array()

$_help

protected mixed $_help = alse

$_hiddenVariables

protected mixed $_hiddenVariables = array()

$_name

protected mixed $_name = ''

$_open_section

protected mixed $_open_section = ull

$_sections

protected mixed $_sections = array()

$_submitted

protected mixed $_submitted = ull

$_title

protected mixed $_title = ''

$_useFormToken

protected mixed $_useFormToken = rue

$_variables

protected mixed $_variables = array()

$_vars

protected mixed $_vars

Methods

__construct()

public __construct(mixed $vars[, mixed $title = '' ][, mixed $name = null ]) : mixed
Parameters
$vars : mixed
$title : mixed = ''
$name : mixed = null
Return values
mixed —

add()

public add(mixed $varName, mixed $type, mixed $humanName, mixed $required[, mixed $readonly = false ][, mixed $description = null ][, mixed $params = array() ]) : mixed
Parameters
$varName : mixed
$type : mixed
$humanName : mixed
$required : mixed
$readonly : mixed = false
$description : mixed = null
$params : mixed = array()
Return values
mixed —

addHidden()

TODO

public addHidden(mixed $varName, mixed $type, mixed $required[, mixed $params = array() ]) : mixed
Parameters
$varName : mixed
$type : mixed
$required : mixed
$params : mixed = array()
Return values
mixed —

addVariable()

TODO

public addVariable(mixed $humanName, mixed $varName, mixed $type, mixed $required[, mixed $readonly = false ][, mixed $description = null ][, mixed $params = array() ]) : mixed
Parameters
$humanName : mixed
$varName : mixed
$type : mixed
$required : mixed
$readonly : mixed = false
$description : mixed = null
$params : mixed = array()
Return values
mixed —

clearError()

public clearError(mixed $var) : mixed
Parameters
$var : mixed
Return values
mixed —

clearValidation()

public clearValidation() : mixed
Return values
mixed —

execute()

public execute() : mixed
Return values
mixed —

getError()

public getError(mixed $var) : mixed
Parameters
$var : mixed
Return values
mixed —

getHiddenVariables()

public getHiddenVariables() : mixed
Return values
mixed —

getInfo()

Fetch the field values of the submitted form.

public getInfo(array<string|int, mixed> &$info) : mixed
Parameters
$info : array<string|int, mixed>

Array to be filled with the submitted field values.

Return values
mixed —

getName()

public getName() : mixed
Return values
mixed —

getOpenSection()

public getOpenSection() : mixed
Return values
mixed —

getRenderer()

Get the renderer for this form, either a custom renderer or the standard one.

public getRenderer([array<string|int, mixed> $params = array() ]) : object

To use a custom form renderer, your form class needs to override this function: function getRenderer() { return new CustomFormRenderer(); }

... where CustomFormRenderer is the classname of the custom renderer class, which should extend Horde_Core_Form_Renderer.

Parameters
$params : array<string|int, mixed> = array()

A hash of renderer-specific parameters.

Return values
object —

Horde_Core_Form_Renderer The form renderer.

getSectionDesc()

public getSectionDesc(mixed $section) : mixed
Parameters
$section : mixed
Return values
mixed —

getSectionExpandedState()

public getSectionExpandedState(mixed $section[, mixed $boolean = false ]) : mixed
Parameters
$section : mixed
$boolean : mixed = false
Return values
mixed —

getSectionImage()

public getSectionImage(mixed $section) : mixed
Parameters
$section : mixed
Return values
mixed —

getSections()

public getSections() : mixed
Return values
mixed —

getTitle()

public getTitle() : mixed
Return values
mixed —

getType()

public getType(mixed $type[, mixed $params = array() ]) : mixed
Parameters
$type : mixed
$params : mixed = array()
Return values
mixed —

getVariables()

public getVariables([mixed $flat = true ][, mixed $withHidden = false ]) : mixed
Parameters
$flat : mixed = true
$withHidden : mixed = false
Return values
mixed —

getVars()

public getVars() : mixed
Return values
mixed —

hasHelp()

public hasHelp() : mixed
Return values
mixed —

insertVariableBefore()

TODO

public insertVariableBefore(mixed $before, mixed $humanName, mixed $varName, mixed $type, mixed $required[, mixed $readonly = false ][, mixed $description = null ][, mixed $params = array() ]) : mixed
Parameters
$before : mixed
$humanName : mixed
$varName : mixed
$type : mixed
$required : mixed
$readonly : mixed = false
$description : mixed = null
$params : mixed = array()
Return values
mixed —

isSubmitted()

Determines if this form has been submitted or not. If the class var _submitted is null then it will check for the presence of the formname in the form variables.

public isSubmitted() : bool

Other events can explicitly set the _submitted variable to false to indicate a form submit but not for actual posting of data (eg. onChange events to update the display of fields).

Return values
bool —

True or false indicating if the form has been submitted.

isValid()

public isValid() : mixed
Return values
mixed —

onSubmit()

Checks if there is anything to do on the submission of the form by looping through each variable's onSubmit() function.

public onSubmit() : mixed
Return values
mixed —

preserve()

Preserve the variables/values from another Horde_Core_Form object.

public preserve(Horde_Core_Form $form) : mixed
Parameters
$form : Horde_Core_Form
Return values
mixed —

removeVariable()

Removes a variable from the form.

public removeVariable(Horde_Core_Form_Variable|string &$var) : bool

As only variables can be passed by reference, you need to call this method this way if want to pass a variable name: $form->removeVariable($var = 'varname');

Parameters
$var : Horde_Core_Form_Variable|string

Either the variable's name or the variable to remove from the form.

Return values
bool —

True if the variable was found (and deleted).

setError()

public setError(mixed $var, mixed $message) : mixed
Parameters
$var : mixed
$message : mixed
Return values
mixed —

setOpenSection()

public setOpenSection(mixed $section) : mixed
Parameters
$section : mixed
Return values
mixed —

setSection()

public setSection([mixed $section = '' ][, mixed $desc = '' ][, mixed $image = '' ][, mixed $expanded = true ]) : mixed
Parameters
$section : mixed = ''
$desc : mixed = ''
$image : mixed = ''
$expanded : mixed = true
Return values
mixed —

setSubmitted()

Explicitly sets the state of the form submit.

public setSubmitted([bool $state = true ]) : mixed

An event can override the automatic determination of the submit state in the isSubmitted() function.

Parameters
$state : bool = true

Whether to set the state of the form as being submitted.

Return values
mixed —

setTitle()

public setTitle(mixed $title) : mixed
Parameters
$title : mixed
Return values
mixed —

setVars()

public setVars(mixed $vars) : mixed
Parameters
$vars : mixed
Return values
mixed —

useToken()

Sets or gets whether the form should be verified by tokens.

public useToken([bool $token = null ]) : bool

Tokens are used to verify that a form is only submitted once.

Parameters
$token : bool = null

If specified, sets whether to use form tokens.

Return values
bool —

Whether form tokens are being used.

validate()

Does the action of validating the form, checking if it really has been submitted by calling isSubmitted() and if true does any onSubmit() calls for var types in the form. The _submitted var is then rechecked.

public validate([mixed $canAutoFill = false ]) : bool
Parameters
$canAutoFill : mixed = false
Return values
bool —

True if the form is valid.

_getInfoFromVariables()

Fetch the field values from a given array of variables.

protected _getInfoFromVariables(array<string|int, mixed> $variables, array<string|int, mixed> &$info) : mixed
Parameters
$variables : array<string|int, mixed>

An array of Horde_Core_Form_Variable objects to fetch from.

$info : array<string|int, mixed>

The array to be filled with the submitted field values.

Tags
access

private

Return values
mixed —

Search results