Properties

$_sections

$_sections : 

Type

$_help

$_help : 

Type

$_name

$_name : 

Type

$_title

$_title : 

Type

$_extra

$_extra : 

Type

$_vars

$_vars : 

Type

$_submit

$_submit : 

Type

$_reset

$_reset : 

Type

$_errors

$_errors : 

Type

$_submitted

$_submitted : 

Type

$_open_section

$_open_section : 

Type

$_currentSection

$_currentSection : 

Type

$_variables

$_variables : 

Type

$_hiddenVariables

$_hiddenVariables : 

Type

$_useFormToken

$_useFormToken : 

Type

$_autofilled

$_autofilled : 

Type

$_enctype

$_enctype : 

Type

Methods

__construct()

__construct(  $vars,   $title = '',   $name = null) 

Parameters

$vars
$title
$name

singleton()

singleton(  $form,   $vars,   $title = '',   $name = null) 

Parameters

$form
$vars
$title
$name

setVars()

setVars(  $vars) 

Parameters

$vars

getVars()

getVars() 

getTitle()

getTitle() 

setTitle()

setTitle(  $title) 

Parameters

$title

getExtra()

getExtra() 

setExtra()

setExtra(  $extra) 

Parameters

$extra

getName()

getName() 

useToken()

useToken(boolean  $token = null) : boolean

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

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

Parameters

boolean $token

If specified, sets whether to use form tokens.

Returns

boolean —

Whether form tokens are being used.

getRenderer()

getRenderer(array  $params = array()) : object

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

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_Form_Renderer.

Parameters

array $params

A hash of renderer-specific parameters.

Returns

object —

Horde_Form_Renderer The form renderer.

getType()

getType(  $type,   $params = array()) 

Parameters

$type
$params

Throws

\Horde_Exception

setSection()

setSection(  $section = '',   $desc = '',   $image = '',   $expanded = true) 

Parameters

$section
$desc
$image
$expanded

getSectionDesc()

getSectionDesc(  $section) 

Parameters

$section

getSectionImage()

getSectionImage(  $section) 

Parameters

$section

setOpenSection()

setOpenSection(  $section) 

Parameters

$section

getOpenSection()

getOpenSection() 

getSectionExpandedState()

getSectionExpandedState(  $section,   $boolean = false) 

Parameters

$section
$boolean

addVariable()

addVariable(  $humanName,   $varName,   $type,   $required,   $readonly = false,   $description = null,   $params = array()) 

TODO

Parameters

$humanName
$varName
$type
$required
$readonly
$description
$params

insertVariableBefore()

insertVariableBefore(  $before,   $humanName,   $varName,   $type,   $required,   $readonly = false,   $description = null,   $params = array()) 

TODO

Parameters

$before
$humanName
$varName
$type
$required
$readonly
$description
$params

removeVariable()

removeVariable(\Horde_Form_Variable|string  $var) : boolean

Removes a variable from the form.

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

\Horde_Form_Variable|string $var

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

Returns

boolean —

True if the variable was found (and deleted).

addHidden()

addHidden(  $humanName,   $varName,   $type,   $required,   $readonly = false,   $description = null,   $params = array()) 

TODO

Parameters

$humanName
$varName
$type
$required
$readonly
$description
$params

getVariables()

getVariables(  $flat = true,   $withHidden = false) 

Parameters

$flat
$withHidden

setButtons()

setButtons(  $submit,   $reset = false) 

Parameters

$submit
$reset

appendButtons()

appendButtons(  $submit) 

Parameters

$submit

preserveVarByPost()

preserveVarByPost(  $vars,   $varname,   $alt_varname = '') 

Parameters

$vars
$varname
$alt_varname

_preserveVarByPost()

_preserveVarByPost(  $varname,   $value) 

Parameters

$varname
$value

open()

open(  $renderer,   $vars,   $action,   $method = 'get',   $enctype = null) 

Parameters

$renderer
$vars
$action
$method
$enctype

close()

close(  $renderer) 

Parameters

$renderer

renderActive()

renderActive(\Horde_Form_Renderer  $renderer = null, \Variables  $vars = null, string  $action = '', string  $method = 'get', string  $enctype = null, boolean  $focus = true) 

Renders the form for editing.

Parameters

\Horde_Form_Renderer $renderer

A renderer instance, optional since Horde 3.2.

\Variables $vars

A Variables instance, optional since Horde 3.2.

string $action

The form action (url).

string $method

The form method, usually either 'get' or 'post'.

string $enctype

The form encoding type. Determined automatically if null.

boolean $focus

Focus the first form field?

renderInactive()

renderInactive(\Horde_Form_Renderer  $renderer = null, \Variables  $vars = null) 

Renders the form for displaying.

Parameters

\Horde_Form_Renderer $renderer

A renderer instance, optional since Horde 3.2.

\Variables $vars

A Variables instance, optional since Horde 3.2.

preserve()

preserve(  $vars) 

Parameters

$vars

unsetVars()

unsetVars(  $vars) 

Parameters

$vars

validate()

validate(\Variables  $vars = null,   $canAutoFill = false) : boolean

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

Parameters

\Variables $vars

A Variables instance, optional since Horde 3.2.

$canAutoFill

Returns

boolean —

True if the form is valid.

clearValidation()

clearValidation() 

getErrors()

getErrors() 

getError()

getError(  $var) 

Parameters

$var

setError()

setError(  $var,   $message) 

Parameters

$var
$message

clearError()

clearError(  $var) 

Parameters

$var

isValid()

isValid() 

execute()

execute() 

getInfo()

getInfo(\Variables  $vars, array  $info) 

Fetch the field values of the submitted form.

Parameters

\Variables $vars

A Variables instance, optional since Horde 3.2.

array $info

Array to be filled with the submitted field values.

_getInfoFromVariables()

_getInfoFromVariables(array  $variables, object  $vars, array  $info) 

Fetch the field values from a given array of variables.

Parameters

array $variables

An array of Horde_Form_Variable objects to fetch from.

object $vars

The Variables object.

array $info

The array to be filled with the submitted field values.

hasHelp()

hasHelp() 

isSubmitted()

isSubmitted() : boolean

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.

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).

Returns

boolean —

True or false indicating if the form has been submitted.

onSubmit()

onSubmit(\Horde_Variables  $vars) 

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

Parameters

\Horde_Variables $vars

setSubmitted()

setSubmitted(boolean  $state = true) 

Explicitly sets the state of the form submit.

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

Parameters

boolean $state

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