API Documentation

Form.php

Includes Classes 
category
Zend
copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_Form
Classes
Zend_Form

Description

Zend Framework

LICENSE

This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.

Zend_Form

Implements
Zend_Validate_Interface
category
Zend
copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_Form
version
$Id: Form.php 22465 2010-06-19 17:41:03Z alab $
Constants
DECORATOR
ELEMENT
METHOD_DELETE
METHOD_GET
METHOD_POST
METHOD_PUT
ENCTYPE_URLENCODED
ENCTYPE_MULTIPART
Properties
$_attribs
$_decorators
$_defaultDisplayGroupClass
$_description
$_disableLoadDefaultDecorators
$_displayGroupPrefixPaths
$_displayGroups
$_elementDecorators
$_elementPrefixPaths
$_elements
$_elementsBelongTo
$_errorMessages
$_errorsExist
$_errorsForced
$_formOrder
$_isArray
$_legend
$_loaders
$_methods
$_order
$_orderUpdated
$_subFormPrefixPaths
$_subForms
$_translator
$_translatorDefault
$_translatorDisabled
$_view
$_isRendered
Methods
__construct
__clone
reset
init
setOptions
setConfig
setPluginLoader
getPluginLoader
addPrefixPath
addPrefixPaths
addElementPrefixPath
addElementPrefixPaths
addDisplayGroupPrefixPath
addDisplayGroupPrefixPaths
setAttrib
addAttribs
setAttribs
getAttrib
getAttribs
removeAttrib
clearAttribs
setAction
getAction
setMethod
getMethod
setEnctype
getEnctype
filterName
setName
getName
getFullyQualifiedName
getId
setLegend
getLegend
setDescription
getDescription
setOrder
getOrder
_setIsRendered
_getIsRendered
addElement
createElement
addElements
setElements
getElement
getElements
removeElement
clearElements
setDefaults
setDefault
getValue
getValues
getValidValues
getUnfilteredValue
getUnfilteredValues
setElementFilters
setElementsBelongTo
_setElementsBelongTo
getElementsBelongTo
setIsArray
isArray
addSubForm
addSubForms
setSubForms
getSubForm
getSubForms
removeSubForm
clearSubForms
setDefaultDisplayGroupClass
getDefaultDisplayGroupClass
addDisplayGroup
_addDisplayGroupObject
addDisplayGroups
setDisplayGroups
getDisplayGroup
getDisplayGroups
removeDisplayGroup
clearDisplayGroups
populate
_getArrayName
_dissolveArrayValue
_dissolveArrayUnsetKey
_attachToArray
getElementsAndSubFormsOrdered
_array_replace_recursive
isValid
isValidPartial
processAjax
addErrorMessage
addErrorMessages
setErrorMessages
getErrorMessages
clearErrorMessages
markAsError
addError
addErrors
setErrors
persistData
isErrors
getErrors
getMessages
getCustomMessages
setView
getView
_getDecorator
addDecorator
addDecorators
setDecorators
getDecorator
getDecorators
removeDecorator
clearDecorators
setElementDecorators
setDisplayGroupDecorators
setSubFormDecorators
render
__toString
setTranslator
setDefaultTranslator
getTranslator
hasTranslator
getDefaultTranslator
hasDefaultTranslator
setDisableTranslator
translatorIsDisabled
__get
__set
__isset
__unset
__call
current
key
next
rewind
valid
count
setDisableLoadDefaultDecorators
loadDefaultDecoratorsIsDisabled
loadDefaultDecorators
_sort
_loadDecorator
_getErrorMessages

Description

Zend_Form

Constants

DECORATOR

 DECORATOR = 'DECORATOR'

Details

value
DECORATOR

ELEMENT

 ELEMENT = 'ELEMENT'

Details

value
ELEMENT

METHOD_DELETE

 METHOD_DELETE = 'delete'

Details

value
delete

METHOD_GET

 METHOD_GET = 'get'

Details

value
get

METHOD_POST

 METHOD_POST = 'post'

Details

value
post

METHOD_PUT

 METHOD_PUT = 'put'

Details

value
put

ENCTYPE_URLENCODED

 ENCTYPE_URLENCODED = 'application/x-www-form-urlencoded'

Details

value
application/x-www-form-urlencoded

ENCTYPE_MULTIPART

 ENCTYPE_MULTIPART = 'multipart/form-data'

Details

value
multipart/form-data

Properties

$_attribs

array $_attribs = 'array'

Form metadata and attributes

Details

$_attribs
array
visibility
protected
default
array
final
false
static
false

$_decorators

array $_decorators = 'array'

Decorators for rendering

Details

$_decorators
array
visibility
protected
default
array
final
false
static
false

$_defaultDisplayGroupClass

string $_defaultDisplayGroupClass = 'Zend_Form_DisplayGroup'

Default display group class

Details

$_defaultDisplayGroupClass
string
visibility
protected
default
Zend_Form_DisplayGroup
final
false
static
false

$_description

string $_description = ''

Form description

Details

$_description
string
visibility
protected
default
final
false
static
false

$_disableLoadDefaultDecorators

bool $_disableLoadDefaultDecorators = 'false'

Should we disable loading the default decorators?

Details

$_disableLoadDefaultDecorators
bool
visibility
protected
default
false
final
false
static
false

$_displayGroupPrefixPaths

array $_displayGroupPrefixPaths = 'array'

Display group prefix paths

Details

$_displayGroupPrefixPaths
array
visibility
protected
default
array
final
false
static
false

$_displayGroups

array $_displayGroups = 'array'

Groups of elements grouped for display purposes

Details

$_displayGroups
array
visibility
protected
default
array
final
false
static
false

$_elementDecorators

null|array $_elementDecorators = ''

Global decorators to apply to all elements

Details

$_elementDecorators
null|array
visibility
protected
default
final
false
static
false

$_elementPrefixPaths

array $_elementPrefixPaths = 'array'

Prefix paths to use when creating elements

Details

$_elementPrefixPaths
array
visibility
protected
default
array
final
false
static
false

$_elements

array $_elements = 'array'

Form elements

Details

$_elements
array
visibility
protected
default
array
final
false
static
false

$_elementsBelongTo

string $_elementsBelongTo = ''

Array to which elements belong (if any)

Details

$_elementsBelongTo
string
visibility
protected
default
final
false
static
false

$_errorMessages

array $_errorMessages = 'array'

Custom form-level error messages

Details

$_errorMessages
array
visibility
protected
default
array
final
false
static
false

$_errorsExist

bool $_errorsExist = 'false'

Are there errors in the form?

Details

$_errorsExist
bool
visibility
protected
default
false
final
false
static
false

$_errorsForced

bool $_errorsForced = 'false'

Has the form been manually flagged as an error?

Details

$_errorsForced
bool
visibility
protected
default
false
final
false
static
false

$_formOrder

int|null $_formOrder = ''

Form order

Details

$_formOrder
int|null
visibility
protected
default
final
false
static
false

$_isArray

bool $_isArray = 'false'

Whether or not form elements are members of an array

Details

$_isArray
bool
visibility
protected
default
false
final
false
static
false

$_isRendered

bool $_isRendered = 'false'

Details

$_isRendered
bool
visibility
protected
default
false
final
false
static
false

$_legend

string $_legend = ''

Form legend

Details

$_legend
string
visibility
protected
default
final
false
static
false

$_loaders

array $_loaders = 'array'

Plugin loaders

Details

$_loaders
array
visibility
protected
default
array
final
false
static
false

$_methods

array $_methods = 'array'

Allowed form methods

Details

$_methods
array
visibility
protected
default
array
final
false
static
false

$_order

array $_order = 'array'

Order in which to display and iterate elements

Details

$_order
array
visibility
protected
default
array
final
false
static
false

$_orderUpdated

bool $_orderUpdated = 'false'

Whether internal order has been updated or not

Details

$_orderUpdated
bool
visibility
protected
default
false
final
false
static
false

$_subFormPrefixPaths

array $_subFormPrefixPaths = 'array'

Sub form prefix paths

Details

$_subFormPrefixPaths
array
visibility
protected
default
array
final
false
static
false

$_subForms

array $_subForms = 'array'

Sub forms

Details

$_subForms
array
visibility
protected
default
array
final
false
static
false

$_translator

Zend_Translate $_translator = ''

Details

$_translator
Zend_Translate
visibility
protected
default
final
false
static
false

$_translatorDefault

Zend_Translate $_translatorDefault = ''

Global default translation adapter

Details

$_translatorDefault
Zend_Translate
visibility
protected
default
final
false
static
true

$_translatorDisabled

bool $_translatorDisabled = 'false'

is the translator disabled?

Details

$_translatorDisabled
bool
visibility
protected
default
false
final
false
static
false

$_view

Zend_View_Interface $_view = ''

Details

$_view
Zend_View_Interface
visibility
protected
default
final
false
static
false

Methods

__call

__call( string $method, array $args ) : string

Overloading: allow rendering specific decorators

Call renderDecoratorName() to render a specific decorator.

Arguments
$method
string
$args
array
Output
string
Details
visibility
public
final
false
static
false
throws
for invalid decorator or invalid method call

__clone

__clone( ) : void

Clone form object and all children

Details
visibility
public
final
false
static
false

__construct

__construct( mixed $options = null ) : void

Constructor

Registers form view helper as decorator

Arguments
$options
mixed
Details
visibility
public
final
false
static
false

__get

__get( string $name ) : Zend_Form_Element|Zend_Form|null

Overloading: access to elements, form groups, and display groups

Arguments
$name
string
Details
visibility
public
final
false
static
false

__isset

__isset( string $name ) : boolean

Overloading: access to elements, form groups, and display groups

Arguments
$name
string
Output
boolean
Details
visibility
public
final
false
static
false

__set

__set( string $name, Zend_Form_Element|Zend_Form $value ) : void

Overloading: access to elements, form groups, and display groups

Arguments
$name
string
$value
Zend_Form_ElementZend_Form
Details
visibility
public
final
false
static
false
throws
for invalid $value

__toString

__toString( ) : string

Serialize as string

Proxies to {@link render()}.

Output
string
Details
visibility
public
final
false
static
false

__unset

__unset( string $name ) : void

Overloading: access to elements, form groups, and display groups

Arguments
$name
string
Details
visibility
public
final
false
static
false

_addDisplayGroupObject

_addDisplayGroupObject( Zend_Form_DisplayGroup $group, string|null $name = null ) : Zend_Form

Add a display group object (used with cloning)

Arguments
$group
Zend_Form_DisplayGroup
$name
stringnull
Output
Zend_Form
Details
visibility
protected
final
false
static
false

_array_replace_recursive

_array_replace_recursive( array $into ) : void

This is a helper function until php 5.3 is widespreaded

Arguments
$into
array
Details
visibility
protected
final
false
static
false
access
protected

_attachToArray

_attachToArray( mixed $value, string $arrayPath ) : array

Converts given arrayPath to an array and attaches given value at the end of it.

Arguments
$value
mixed
The value to attach
$arrayPath
string
Given array path to convert and attach to.
Output
array
Details
visibility
protected
final
false
static
false

_dissolveArrayUnsetKey

_dissolveArrayUnsetKey( array $array, string|null $arrayPath, string $key ) : array

Given an array, an optional arrayPath and a key this method dissolves the arrayPath and unsets the key within the array if it exists.

Arguments
$array
array
$arrayPath
stringnull
$key
string
Output
array
Details
visibility
protected
final
false
static
false

_dissolveArrayValue

_dissolveArrayValue( array $value, string $arrayPath ) : string

Extract the value by walking the array using given array path.

Given an array path such as foo[bar][baz], returns the value of the last element (in this case, 'baz').

Arguments
$value
array
Array to walk
$arrayPath
string
Array notation path of the part to extract
Output
string
Details
visibility
protected
final
false
static
false

_getArrayName

_getArrayName( string $value ) : string

Determine array key name from given value

Given a value such as foo[bar][baz], returns the last element (in this case, 'baz').

Arguments
$value
string
Output
string
Details
visibility
protected
final
false
static
false

_getDecorator

_getDecorator( string $name, null|array $options ) : Zend_Form_Decorator_Interface

Instantiate a decorator based on class name or class name fragment

Arguments
$name
string
$options
nullarray
Details
visibility
protected
final
false
static
false

_getErrorMessages

_getErrorMessages( ) : array

Retrieve optionally translated custom error messages

Output
array
Details
visibility
protected
final
false
static
false

_getIsRendered

_getIsRendered( ) :

Get the value of $_isRendered member

Details
visibility
protected
final
false
static
false

_loadDecorator

_loadDecorator( array $decorator, mixed $name ) : Zend_Form_Decorator_Interface

Lazy-load a decorator

Arguments
$decorator
array
Decorator type and options
$name
mixed
Decorator name or alias
Details
visibility
protected
final
false
static
false

_setElementsBelongTo

_setElementsBelongTo( string $name = null ) : void

Set array to which elements belong

Arguments
$name
string
Element name
Details
visibility
protected
final
false
static
false

_setIsRendered

_setIsRendered( ) :

When calling renderFormElements or render this method is used to set $_isRendered member to prevent repeatedly merging belongsTo setting

Details
visibility
protected
final
false
static
false

_sort

_sort( ) : void

Sort items according to their order

Details
visibility
protected
final
false
static
false

addAttribs

addAttribs( array $attribs ) : Zend_Form

Add multiple form attributes at once

Arguments
$attribs
array
Output
Zend_Form
Details
visibility
public
final
false
static
false

addDecorator

addDecorator( string|Zend_Form_Decorator_Interface $decorator, array|Zend_Config $options = null ) : Zend_Form

Add a decorator for rendering the element

Arguments
$decorator
stringZend_Form_Decorator_Interface
$options
arrayZend_Config
Options with which to initialize decorator
Output
Zend_Form
Details
visibility
public
final
false
static
false

addDecorators

addDecorators( array $decorators ) : Zend_Form

Add many decorators at once

Arguments
$decorators
array
Output
Zend_Form
Details
visibility
public
final
false
static
false

addDisplayGroup

addDisplayGroup( array $elements, string $name, array|Zend_Config $options = null ) : Zend_Form

Add a display group

Groups named elements for display purposes.

If a referenced element does not yet exist in the form, it is omitted.

Arguments
$elements
array
$name
string
$options
arrayZend_Config
Output
Zend_Form
Details
visibility
public
final
false
static
false
throws
if no valid elements provided

addDisplayGroupPrefixPath

addDisplayGroupPrefixPath( string $prefix, string $path ) : Zend_Form

Add prefix path for all display groups

Arguments
$prefix
string
$path
string
Output
Zend_Form
Details
visibility
public
final
false
static
false

addDisplayGroupPrefixPaths

addDisplayGroupPrefixPaths( array $spec ) : Zend_Form

Add multiple display group prefix paths at once

Arguments
$spec
array
Output
Zend_Form
Details
visibility
public
final
false
static
false

addDisplayGroups

addDisplayGroups( array $groups ) : Zend_Form

Add multiple display groups at once

Arguments
$groups
array
Output
Zend_Form
Details
visibility
public
final
false
static
false

addElement

addElement( string|Zend_Form_Element $element, string $name = null, array|Zend_Config $options = null ) : Zend_Form

Add a new element

$element may be either a string element type, or an object of type Zend_Form_Element. If a string element type is provided, $name must be provided, and $options may be optionally provided for configuring the element.

If a Zend_Form_Element is provided, $name may be optionally provided, and any provided $options will be ignored.

Arguments
$element
stringZend_Form_Element
$name
string
$options
arrayZend_Config
Output
Zend_Form
Details
visibility
public
final
false
static
false

addElementPrefixPath

addElementPrefixPath( string $prefix, string $path, string $type = null ) : Zend_Form

Add prefix path for all elements

Arguments
$prefix
string
$path
string
$type
string
Output
Zend_Form
Details
visibility
public
final
false
static
false

addElementPrefixPaths

addElementPrefixPaths( array $spec ) : Zend_Form

Add prefix paths for all elements

Arguments
$spec
array
Output
Zend_Form
Details
visibility
public
final
false
static
false

addElements

addElements( array $elements ) : Zend_Form

Add multiple elements at once

Arguments
$elements
array
Output
Zend_Form
Details
visibility
public
final
false
static
false

addError

addError( string $message ) : Zend_Form

Add an error message and mark element as failed validation

Arguments
$message
string
Output
Zend_Form
Details
visibility
public
final
false
static
false

addErrorMessage

addErrorMessage( string $message ) : Zend_Form

Add a custom error message to return in the event of failed validation

Arguments
$message
string
Output
Zend_Form
Details
visibility
public
final
false
static
false

addErrorMessages

addErrorMessages( array $messages ) : Zend_Form

Add multiple custom error messages to return in the event of failed validation

Arguments
$messages
array
Output
Zend_Form
Details
visibility
public
final
false
static
false

addErrors

addErrors( array $messages ) : Zend_Form

Add multiple error messages and flag element as failed validation

Arguments
$messages
array
Output
Zend_Form
Details
visibility
public
final
false
static
false

addPrefixPath

addPrefixPath( string $prefix, string $path, string $type = null ) : Zend_Form

Add prefix path for plugin loader

If no $type specified, assumes it is a base path for both filters and validators, and sets each according to the following rules: - decorators: $prefix = $prefix . '_Decorator' - elements: $prefix = $prefix . '_Element'

Otherwise, the path prefix is set on the appropriate plugin loader.

If $type is 'decorator', sets the path in the decorator plugin loader for all elements. Additionally, if no $type is provided, the prefix and path is added to both decorator and element plugin loader with following settings: $prefix . '_Decorator', $path . '/Decorator/' $prefix . '_Element', $path . '/Element/'

Arguments
$prefix
string
$path
string
$type
string
Output
Zend_Form
Details
visibility
public
final
false
static
false
throws
for invalid type

addPrefixPaths

addPrefixPaths( array $spec ) : Zend_Form

Add many prefix paths at once

Arguments
$spec
array
Output
Zend_Form
Details
visibility
public
final
false
static
false

addSubForm

addSubForm( Zend_Form $form, string $name, int $order = null ) : Zend_Form

Add a form group/subform

Arguments
$form
Zend_Form
$name
string
$order
int
Output
Zend_Form
Details
visibility
public
final
false
static
false

addSubForms

addSubForms( array $subForms ) : Zend_Form

Add multiple form subForms/subforms at once

Arguments
$subForms
array
Output
Zend_Form
Details
visibility
public
final
false
static
false

clearAttribs

clearAttribs( ) : Zend_Form

Clear all form attributes

Output
Zend_Form
Details
visibility
public
final
false
static
false

clearDecorators

clearDecorators( ) : Zend_Form

Clear all decorators

Output
Zend_Form
Details
visibility
public
final
false
static
false

clearDisplayGroups

clearDisplayGroups( ) : Zend_Form

Remove all display groups

Output
Zend_Form
Details
visibility
public
final
false
static
false

clearElements

clearElements( ) : Zend_Form

Remove all form elements

Output
Zend_Form
Details
visibility
public
final
false
static
false

clearErrorMessages

clearErrorMessages( ) : Zend_Form

Clear custom error messages stack

Output
Zend_Form
Details
visibility
public
final
false
static
false

clearSubForms

clearSubForms( ) : Zend_Form

Remove all form subForms/subforms

Output
Zend_Form
Details
visibility
public
final
false
static
false

count

count( ) : int

Count of elements/subforms that are iterable

Output
int
Details
visibility
public
final
false
static
false

createElement

createElement( string $type, string $name, array|Zend_Config $options = null ) : Zend_Form_Element

Create an element

Acts as a factory for creating elements. Elements created with this method will not be attached to the form, but will contain element settings as specified in the form object (including plugin loader prefix paths, default decorators, etc.).

Arguments
$type
string
$name
string
$options
arrayZend_Config
Details
visibility
public
final
false
static
false

current

current( ) : Zend_Form_Element|Zend_Form_DisplayGroup|Zend_Form

Current element/subform/display group

Details
visibility
public
final
false
static
false

filterName

filterName( string $value, bool $allowBrackets = false ) : string

Filter a name to only allow valid variable characters

Arguments
$value
string
$allowBrackets
bool
Output
string
Details
visibility
public
final
false
static
false

getAction

getAction( ) : string

Get form action

Sets default to '' if not set.

Output
string
Details
visibility
public
final
false
static
false

getAttrib

getAttrib( string $key ) : mixed

Retrieve a single form attribute

Arguments
$key
string
Output
mixed
Details
visibility
public
final
false
static
false

getAttribs

getAttribs( ) : array

Retrieve all form attributes/metadata

Output
array
Details
visibility
public
final
false
static
false

getCustomMessages

getCustomMessages( ) : array

Retrieve translated custom error messages Proxies to {@link _getErrorMessages()}.

Output
array
Details
visibility
public
final
false
static
false

getDecorator

getDecorator( string $name ) : false|Zend_Form_Decorator_Abstract

Retrieve a registered decorator

Arguments
$name
string
Details
visibility
public
final
false
static
false

getDecorators

getDecorators( ) : array

Retrieve all decorators

Output
array
Details
visibility
public
final
false
static
false

getDefaultDisplayGroupClass

getDefaultDisplayGroupClass( ) : string

Retrieve default display group class

Output
string
Details
visibility
public
final
false
static
false

getDefaultTranslator

getDefaultTranslator( ) : null|Zend_Translate

Get global default translator object

Output
null|Zend_Translate
Details
visibility
public
final
false
static
true

getDescription

getDescription( ) : string

Retrieve form description

Output
string
Details
visibility
public
final
false
static
false

getDisplayGroup

getDisplayGroup( string $name ) : Zend_Form_DisplayGroup|null

Return a display group

Arguments
$name
string
Details
visibility
public
final
false
static
false

getDisplayGroups

getDisplayGroups( ) : array

Return all display groups

Output
array
Details
visibility
public
final
false
static
false

getElement

getElement( string $name ) : Zend_Form_Element|null

Retrieve a single element

Arguments
$name
string
Output
Zend_Form_Element|null
Details
visibility
public
final
false
static
false

getElements

getElements( ) : array

Retrieve all elements

Output
array
Details
visibility
public
final
false
static
false

getElementsAndSubFormsOrdered

getElementsAndSubFormsOrdered( ) : array

Returns a one dimensional numerical indexed array with the Elements, SubForms and Elements from DisplayGroups as Values.

Subitems are inserted based on their order Setting if set, otherwise they are appended, the resulting numerical index may differ from the order value.

Output
array
Details
visibility
public
final
false
static
false
access
protected

getElementsBelongTo

getElementsBelongTo( ) : string|null

Get name of array elements belong to

Output
string|null
Details
visibility
public
final
false
static
false

getEnctype

getEnctype( ) : string

Get encoding type

Output
string
Details
visibility
public
final
false
static
false

getErrorMessages

getErrorMessages( ) : array

Retrieve custom error messages

Output
array
Details
visibility
public
final
false
static
false

getErrors

getErrors( string $name = null,  $suppressArrayNotation = false ) : array

Get error codes for all elements failing validation

Arguments
$name
string
$suppressArrayNotation
Output
array
Details
visibility
public
final
false
static
false

getFullyQualifiedName

getFullyQualifiedName( ) : string

Get fully qualified name

Places name as subitem of array and/or appends brackets.

Output
string
Details
visibility
public
final
false
static
false

getId

getId( ) : string

Get element id

Output
string
Details
visibility
public
final
false
static
false

getLegend

getLegend( ) : string

Get form legend

Output
string
Details
visibility
public
final
false
static
false

getMessages

getMessages( string $name = null, bool $suppressArrayNotation = false ) : array

Retrieve error messages from elements failing validations

Arguments
$name
string
$suppressArrayNotation
bool
Output
array
Details
visibility
public
final
false
static
false

getMethod

getMethod( ) : string

Retrieve form method

Output
string
Details
visibility
public
final
false
static
false

getName

getName( ) : null|string

Get name attribute

Output
null|string
Details
visibility
public
final
false
static
false

getOrder

getOrder( ) : int|null

Get form order

Output
int|null
Details
visibility
public
final
false
static
false

getPluginLoader

getPluginLoader( string $type = null ) : Zend_Loader_PluginLoader_Interface

Retrieve plugin loader for given type

$type may be one of: - decorator - element

If a plugin loader does not exist for the given type, defaults are created.

Arguments
$type
string
Details
visibility
public
final
false
static
false

getSubForm

getSubForm( string $name ) : Zend_Form|null

Retrieve a form subForm/subform

Arguments
$name
string
Output
Zend_Form|null
Details
visibility
public
final
false
static
false

getSubForms

getSubForms( ) : array

Retrieve all form subForms/subforms

Output
array
Details
visibility
public
final
false
static
false

getTranslator

getTranslator( ) : Zend_Translate|null

Retrieve translator object

Output
Zend_Translate|null
Details
visibility
public
final
false
static
false

getUnfilteredValue

getUnfilteredValue( string $name ) : mixed

Get unfiltered element value

Arguments
$name
string
Output
mixed
Details
visibility
public
final
false
static
false

getUnfilteredValues

getUnfilteredValues( ) : array

Retrieve all unfiltered element values

Output
array
Details
visibility
public
final
false
static
false

getValidValues

getValidValues( array $data, bool $suppressArrayNotation = false ) : array

Returns only the valid values from the given form input.

For models that can be saved in a partially valid state, for example when following the builder, prototype or state patterns it is particularly interessting to retrieve all the current valid values to persist them.

Arguments
$data
array
$suppressArrayNotation
bool
Output
array
Details
visibility
public
final
false
static
false

getValue

getValue( string $name ) : mixed

Retrieve value for single element

Arguments
$name
string
Output
mixed
Details
visibility
public
final
false
static
false

getValues

getValues( bool $suppressArrayNotation = false ) : array

Retrieve all form element values

Arguments
$suppressArrayNotation
bool
Output
array
Details
visibility
public
final
false
static
false

getView

getView( ) : Zend_View_Interface|null

Retrieve view object

If none registered, attempts to pull from ViewRenderer.

Output
Zend_View_Interface|null
Details
visibility
public
final
false
static
false

hasDefaultTranslator

hasDefaultTranslator( ) : boolean

Is there a default translation object set?

Output
boolean
Details
visibility
public
final
false
static
true

hasTranslator

hasTranslator( ) : bool

Does this form have its own specific translator?

Output
bool
Details
visibility
public
final
false
static
false

init

init( ) : void

Initialize form (used by extending classes)

Details
visibility
public
final
false
static
false

isArray

isArray( ) : bool

Get flag indicating if elements belong to an array

Output
bool
Details
visibility
public
final
false
static
false

isErrors

isErrors( ) : bool

Are there errors in the form?

Output
bool
Details
visibility
public
final
false
static
false

isValid

isValid( array $data ) : boolean

Validate the form

Arguments
$data
array
Output
boolean
Details
visibility
public
final
false
static
false

isValidPartial

isValidPartial( array $data ) : boolean

Validate a partial form

Does not check for required flags.

Arguments
$data
array
Output
boolean
Details
visibility
public
final
false
static
false

key

key( ) : string

Current element/subform/display group name

Output
string
Details
visibility
public
final
false
static
false

loadDefaultDecorators

loadDefaultDecorators( ) : void

Load the default decorators

Details
visibility
public
final
false
static
false

loadDefaultDecoratorsIsDisabled

loadDefaultDecoratorsIsDisabled( ) : bool

Should we load the default decorators?

Output
bool
Details
visibility
public
final
false
static
false

markAsError

markAsError( ) : Zend_Form

Mark the element as being in a failed validation state

Output
Zend_Form
Details
visibility
public
final
false
static
false

next

next( ) : void

Move pointer to next element/subform/display group

Details
visibility
public
final
false
static
false

persistData

persistData( ) :
Details
visibility
public
final
false
static
false

populate

populate( array $values ) : Zend_Form

Populate form

Proxies to {@link setDefaults()}

Arguments
$values
array
Output
Zend_Form
Details
visibility
public
final
false
static
false

processAjax

processAjax( array $data ) : string

Process submitted AJAX data

Checks if provided $data is valid, via {@link isValidPartial()}. If so, it returns JSON-encoded boolean true. If not, it returns JSON-encoded error messages (as returned by {@link getMessages()}).

Arguments
$data
array
Output
string
JSON-encoded boolean true or error messages
Details
visibility
public
final
false
static
false

removeAttrib

removeAttrib( string $key ) : bool

Remove attribute

Arguments
$key
string
Output
bool
Details
visibility
public
final
false
static
false

removeDecorator

removeDecorator( string $name ) : bool

Remove a single decorator

Arguments
$name
string
Output
bool
Details
visibility
public
final
false
static
false

removeDisplayGroup

removeDisplayGroup( string $name ) : boolean

Remove a display group by name

Arguments
$name
string
Output
boolean
Details
visibility
public
final
false
static
false

removeElement

removeElement( string $name ) : boolean

Remove element

Arguments
$name
string
Output
boolean
Details
visibility
public
final
false
static
false

removeSubForm

removeSubForm( string $name ) : boolean

Remove form subForm/subform

Arguments
$name
string
Output
boolean
Details
visibility
public
final
false
static
false

render

render( Zend_View_Interface $view = null ) : string

Render form

Arguments
$view
Zend_View_Interface
Output
string
Details
visibility
public
final
false
static
false

reset

reset( ) : Zend_Form

Reset values of form

Output
Zend_Form
Details
visibility
public
final
false
static
false

rewind

rewind( ) : void

Move pointer to beginning of element/subform/display group loop

Details
visibility
public
final
false
static
false

setAction

setAction( string $action ) : Zend_Form

Set form action

Arguments
$action
string
Output
Zend_Form
Details
visibility
public
final
false
static
false

setAttrib

setAttrib( string $key, mixed $value ) : Zend_Form

Set form attribute

Arguments
$key
string
$value
mixed
Output
Zend_Form
Details
visibility
public
final
false
static
false

setAttribs

setAttribs( array $attribs ) : Zend_Form

Set multiple form attributes at once

Overwrites any previously set attributes.

Arguments
$attribs
array
Output
Zend_Form
Details
visibility
public
final
false
static
false

setConfig

setConfig( Zend_Config $config ) : Zend_Form

Set form state from config object

Arguments
$config
Zend_Config
Output
Zend_Form
Details
visibility
public
final
false
static
false

setDecorators

setDecorators( array $decorators ) : Zend_Form

Overwrite all decorators

Arguments
$decorators
array
Output
Zend_Form
Details
visibility
public
final
false
static
false

setDefault

setDefault( string $name, mixed $value ) : Zend_Form

Set default value for an element

Arguments
$name
string
$value
mixed
Output
Zend_Form
Details
visibility
public
final
false
static
false

setDefaultDisplayGroupClass

setDefaultDisplayGroupClass( string $class ) : Zend_Form

Set default display group class

Arguments
$class
string
Output
Zend_Form
Details
visibility
public
final
false
static
false

setDefaultTranslator

setDefaultTranslator( Zend_Translate|Zend_Translate_Adapter|null $translator = null ) : void

Set global default translator object

Arguments
$translator
Zend_TranslateZend_Translate_Adapternull
Details
visibility
public
final
false
static
true

setDefaults

setDefaults( array $defaults ) : Zend_Form

Set default values for elements

Sets values for all elements specified in the array of $defaults.

Arguments
$defaults
array
Output
Zend_Form
Details
visibility
public
final
false
static
false

setDescription

setDescription( string $value ) : Zend_Form

Set form description

Arguments
$value
string
Output
Zend_Form
Details
visibility
public
final
false
static
false

setDisableLoadDefaultDecorators

setDisableLoadDefaultDecorators( bool $flag ) : Zend_Form

Set flag to disable loading default decorators

Arguments
$flag
bool
Output
Zend_Form
Details
visibility
public
final
false
static
false

setDisableTranslator

setDisableTranslator( bool $flag ) : Zend_Form

Indicate whether or not translation should be disabled

Arguments
$flag
bool
Output
Zend_Form
Details
visibility
public
final
false
static
false

setDisplayGroupDecorators

setDisplayGroupDecorators( array $decorators ) : Zend_Form

Set all display group decorators as specified

Arguments
$decorators
array
Output
Zend_Form
Details
visibility
public
final
false
static
false

setDisplayGroups

setDisplayGroups( array $groups ) : Zend_Form

Add multiple display groups (overwrites)

Arguments
$groups
array
Output
Zend_Form
Details
visibility
public
final
false
static
false

setElementDecorators

setElementDecorators( array $decorators, array|null $elements = null, bool $include = true ) : Zend_Form

Set all element decorators as specified

Arguments
$decorators
array
$elements
arraynull
Specific elements to decorate or exclude from decoration
$include
bool
Whether $elements is an inclusion or exclusion list
Output
Zend_Form
Details
visibility
public
final
false
static
false

setElementFilters

setElementFilters( array $filters ) : Zend_Form

Set all elements' filters

Arguments
$filters
array
Output
Zend_Form
Details
visibility
public
final
false
static
false

setElements

setElements( array $elements ) : Zend_Form

Set form elements (overwrites existing elements)

Arguments
$elements
array
Output
Zend_Form
Details
visibility
public
final
false
static
false

setElementsBelongTo

setElementsBelongTo( string $array ) : Zend_Form

Set name of array elements belong to

Arguments
$array
string
Output
Zend_Form
Details
visibility
public
final
false
static
false

setEnctype

setEnctype( string $value ) : Zend_Form

Set encoding type

Arguments
$value
string
Output
Zend_Form
Details
visibility
public
final
false
static
false

setErrorMessages

setErrorMessages( array $messages ) : Zend_Form

Same as addErrorMessages(), but clears custom error message stack first

Arguments
$messages
array
Output
Zend_Form
Details
visibility
public
final
false
static
false

setErrors

setErrors( array $messages ) : Zend_Form

Overwrite any previously set error messages and flag as failed validation

Arguments
$messages
array
Output
Zend_Form
Details
visibility
public
final
false
static
false

setIsArray

setIsArray( bool $flag ) : Zend_Form

Set flag indicating elements belong to array

Arguments
$flag
bool
Value of flag
Output
Zend_Form
Details
visibility
public
final
false
static
false

setLegend

setLegend( string $value ) : Zend_Form

Set form legend

Arguments
$value
string
Output
Zend_Form
Details
visibility
public
final
false
static
false

setMethod

setMethod( string $method ) : Zend_Form

Set form method

Only values in {@link $_methods()} allowed

Arguments
$method
string
Output
Zend_Form
Details
visibility
public
final
false
static
false
throws

setName

setName( string $name ) : Zend_Form

Set form name

Arguments
$name
string
Output
Zend_Form
Details
visibility
public
final
false
static
false

setOptions

setOptions( array $options ) : Zend_Form

Set form state from options array

Arguments
$options
array
Output
Zend_Form
Details
visibility
public
final
false
static
false

setOrder

setOrder( int $index ) : Zend_Form

Set form order

Arguments
$index
int
Output
Zend_Form
Details
visibility
public
final
false
static
false

setPluginLoader

setPluginLoader( Zend_Loader_PluginLoader_Interface $loader, string $type = null ) : Zend_Form

Set plugin loaders for use with decorators and elements

Arguments
$loader
Zend_Loader_PluginLoader_Interface
$type
string
'decorator' or 'element'
Output
Zend_Form
Details
visibility
public
final
false
static
false
throws
on invalid type

setSubFormDecorators

setSubFormDecorators( array $decorators ) : Zend_Form

Set all subform decorators as specified

Arguments
$decorators
array
Output
Zend_Form
Details
visibility
public
final
false
static
false

setSubForms

setSubForms( array $subForms ) : Zend_Form

Set multiple form subForms/subforms (overwrites)

Arguments
$subForms
array
Output
Zend_Form
Details
visibility
public
final
false
static
false

setTranslator

setTranslator( Zend_Translate|Zend_Translate_Adapter|null $translator = null ) : Zend_Form

Set translator object

Arguments
$translator
Zend_TranslateZend_Translate_Adapternull
Output
Zend_Form
Details
visibility
public
final
false
static
false

setView

setView( Zend_View_Interface $view = null ) : Zend_Form

Set view object

Arguments
$view
Zend_View_Interface
Output
Zend_Form
Details
visibility
public
final
false
static
false

translatorIsDisabled

translatorIsDisabled( ) : bool

Is translation disabled?

Output
bool
Details
visibility
public
final
false
static
false

valid

valid( ) : bool

Determine if current element/subform/display group is valid

Output
bool
Details
visibility
public
final
false
static
false
Documentation was generated by DocBlox.