Form.php
- Category
- Zend
- Copyright
- Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Package
- Zend_Form
\Zend_Form
- Implements
- Children
- \Zend_Dojo_Form
- \Zend_Form_SubForm
- Category
- Zend
- Copyright
- Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Version
- $Id$
Constants
Properties

string $_defaultDisplayGroupClass = 'Zend_Form_DisplayGroup''Zend_Form_DisplayGroup'Details- Type
- string

bool $_disableLoadDefaultDecorators = falsefalseDetails- Type
- bool

array $_displayGroupPrefixPaths = array()array()Details- Type
- array

array $_displayGroups = array()array()Details- Type
- array

array $_elementPrefixPaths = array()array()Details- Type
- array

bool $_errorsForced = falsefalseDetails- Type
- bool

bool $_isArray = falsefalseDetails- Type
- bool

array $_methods = array('delete', 'get', 'post', 'put')array('delete', 'get', 'post', 'put')Details- Type
- array

array $_order = array()array()Details- Type
- array

bool $_orderUpdated = falsefalseDetails- Type
- bool

\Zend_Translate $_translatorDefault- Type
- \Zend_Translate
Methods

__call(string $method, array $args) : stringOverloading: allow rendering specific decorators
| Name | Type | Description |
|---|---|---|
| $method | string | |
| $args | array |
| Type | Description |
|---|---|
| string |
| Exception | Description |
|---|---|
| \Zend_Form_Exception | for invalid decorator or invalid method call |

__construct(mixed $options = null) : voidConstructor
| Name | Type | Description |
|---|---|---|
| $options | mixed |

__get(string $name) : \Zend_Form_Element | \Zend_Form | nullOverloading: access to elements, form groups, and display groups
| Name | Type | Description |
|---|---|---|
| $name | string |
| Type | Description |
|---|---|
| \Zend_Form_Element | \Zend_Form | null |

__isset(string $name) : booleanOverloading: access to elements, form groups, and display groups
| Name | Type | Description |
|---|---|---|
| $name | string |
| Type | Description |
|---|---|
| boolean |

__set(string $name, \Zend_Form_Element | \Zend_Form $value) : voidOverloading: access to elements, form groups, and display groups
| Name | Type | Description |
|---|---|---|
| $name | string | |
| $value | \Zend_Form_Element | \Zend_Form |
| Exception | Description |
|---|---|
| \Zend_Form_Exception | for invalid $value |

__unset(string $name) : voidOverloading: access to elements, form groups, and display groups
| Name | Type | Description |
|---|---|---|
| $name | string |

_addDisplayGroupObject(\Zend_Form_DisplayGroup $group, string | null $name = null) : \Zend_FormAdd a display group object (used with cloning)
| Name | Type | Description |
|---|---|---|
| $group | \Zend_Form_DisplayGroup | |
| $name | string | null |
| Type | Description |
|---|---|
| \Zend_Form |

_array_replace_recursive(array $into) : voidThis is a helper function until php 5.3 is widespreaded
| Name | Type | Description |
|---|---|---|
| $into | array |
- Access
- protected

_attachToArray(mixed $value, string $arrayPath) : arrayConverts given arrayPath to an array and attaches given value at the end of it.
| Name | Type | Description |
|---|---|---|
| $value | mixed | The value to attach |
| $arrayPath | string | Given array path to convert and attach to. |
| Type | Description |
|---|---|
| array |

_dissolveArrayUnsetKey(array $array, string | null $arrayPath, string $key) : arrayGiven an array, an optional arrayPath and a key this method dissolves the arrayPath and unsets the key within the array if it exists.
| Name | Type | Description |
|---|---|---|
| $array | array | |
| $arrayPath | string | null | |
| $key | string |
| Type | Description |
|---|---|
| array |

_dissolveArrayValue(array $value, string $arrayPath) : stringExtract the value by walking the array using given array path.
| Name | Type | Description |
|---|---|---|
| $value | array | Array to walk |
| $arrayPath | string | Array notation path of the part to extract |
| Type | Description |
|---|---|
| string |

_getArrayName(string $value) : stringDetermine array key name from given value
| Name | Type | Description |
|---|---|---|
| $value | string |
| Type | Description |
|---|---|
| string |

_getDecorator(string $name, null | array $options) : \Zend_Form_Decorator_InterfaceInstantiate a decorator based on class name or class name fragment
| Name | Type | Description |
|---|---|---|
| $name | string | |
| $options | null | array |
| Type | Description |
|---|---|
| \Zend_Form_Decorator_Interface |

_getErrorMessages() : arrayRetrieve optionally translated custom error messages
| Type | Description |
|---|---|
| array |

_loadDecorator(array $decorator, mixed $name) : \Zend_Form_Decorator_InterfaceLazy-load a decorator
| Name | Type | Description |
|---|---|---|
| $decorator | array | Decorator type and options |
| $name | mixed | Decorator name or alias |
| Type | Description |
|---|---|
| \Zend_Form_Decorator_Interface |

_setElementsBelongTo(string $name = null) : voidSet array to which elements belong
| Name | Type | Description |
|---|---|---|
| $name | string | Element name |

_setIsRendered() : voidWhen calling renderFormElements or render this method is used to set $_isRendered member to prevent repeatedly merging belongsTo setting

addAttribs(array $attribs) : \Zend_FormAdd multiple form attributes at once
| Name | Type | Description |
|---|---|---|
| $attribs | array |
| Type | Description |
|---|---|
| \Zend_Form |

addDecorator(string | \Zend_Form_Decorator_Interface $decorator, array | \Zend_Config $options = null) : \Zend_FormAdd a decorator for rendering the element
| Name | Type | Description |
|---|---|---|
| $decorator | string | \Zend_Form_Decorator_Interface | |
| $options | array | \Zend_Config | Options with which to initialize decorator |
| Type | Description |
|---|---|
| \Zend_Form |

addDecorators(array $decorators) : \Zend_FormAdd many decorators at once
| Name | Type | Description |
|---|---|---|
| $decorators | array |
| Type | Description |
|---|---|
| \Zend_Form |

addDisplayGroup(array $elements, string $name, array | \Zend_Config $options = null) : \Zend_FormAdd a display group
| Name | Type | Description |
|---|---|---|
| $elements | array | |
| $name | string | |
| $options | array | \Zend_Config |
| Type | Description |
|---|---|
| \Zend_Form |
| Exception | Description |
|---|---|
| \Zend_Form_Exception | if no valid elements provided |

addDisplayGroupPrefixPath(string $prefix, string $path) : \Zend_FormAdd prefix path for all display groups
| Name | Type | Description |
|---|---|---|
| $prefix | string | |
| $path | string |
| Type | Description |
|---|---|
| \Zend_Form |

addDisplayGroupPrefixPaths(array $spec) : \Zend_FormAdd multiple display group prefix paths at once
| Name | Type | Description |
|---|---|---|
| $spec | array |
| Type | Description |
|---|---|
| \Zend_Form |

addDisplayGroups(array $groups) : \Zend_FormAdd multiple display groups at once
| Name | Type | Description |
|---|---|---|
| $groups | array |
| Type | Description |
|---|---|
| \Zend_Form |

addElement(string | \Zend_Form_Element $element, string $name = null, array | \Zend_Config $options = null) : \Zend_FormAdd a new element
| Name | Type | Description |
|---|---|---|
| $element | string | \Zend_Form_Element | |
| $name | string | |
| $options | array | \Zend_Config |
| Type | Description |
|---|---|
| \Zend_Form |
| Exception | Description |
|---|---|
| \Zend_Form_Exception | on invalid element |

addElementPrefixPath(string $prefix, string $path, string $type = null) : \Zend_FormAdd prefix path for all elements
| Name | Type | Description |
|---|---|---|
| $prefix | string | |
| $path | string | |
| $type | string |
| Type | Description |
|---|---|
| \Zend_Form |

addElementPrefixPaths(array $spec) : \Zend_FormAdd prefix paths for all elements
| Name | Type | Description |
|---|---|---|
| $spec | array |
| Type | Description |
|---|---|
| \Zend_Form |

addElements(array $elements) : \Zend_FormAdd multiple elements at once
| Name | Type | Description |
|---|---|---|
| $elements | array |
| Type | Description |
|---|---|
| \Zend_Form |

addError(string $message) : \Zend_FormAdd an error message and mark element as failed validation
| Name | Type | Description |
|---|---|---|
| $message | string |
| Type | Description |
|---|---|
| \Zend_Form |

addErrorMessage(string $message) : \Zend_FormAdd a custom error message to return in the event of failed validation
| Name | Type | Description |
|---|---|---|
| $message | string |
| Type | Description |
|---|---|
| \Zend_Form |

addErrorMessages(array $messages) : \Zend_FormAdd multiple custom error messages to return in the event of failed validation
| Name | Type | Description |
|---|---|---|
| $messages | array |
| Type | Description |
|---|---|
| \Zend_Form |

addErrors(array $messages) : \Zend_FormAdd multiple error messages and flag element as failed validation
| Name | Type | Description |
|---|---|---|
| $messages | array |
| Type | Description |
|---|---|
| \Zend_Form |

addPrefixPath(string $prefix, string $path, string $type = null) : \Zend_FormAdd prefix path for plugin loader
| Name | Type | Description |
|---|---|---|
| $prefix | string | |
| $path | string | |
| $type | string |
| Type | Description |
|---|---|
| \Zend_Form |
| Exception | Description |
|---|---|
| \Zend_Form_Exception | for invalid type |

addPrefixPaths(array $spec) : \Zend_FormAdd many prefix paths at once
| Name | Type | Description |
|---|---|---|
| $spec | array |
| Type | Description |
|---|---|
| \Zend_Form |

addSubForm(\Zend_Form $form, string $name, int $order = null) : \Zend_FormAdd a form group/subform
| Name | Type | Description |
|---|---|---|
| $form | \Zend_Form | |
| $name | string | |
| $order | int |
| Type | Description |
|---|---|
| \Zend_Form |

addSubForms(array $subForms) : \Zend_FormAdd multiple form subForms/subforms at once
| Name | Type | Description |
|---|---|---|
| $subForms | array |
| Type | Description |
|---|---|
| \Zend_Form |

createElement(string $type, string $name, array | \Zend_Config $options = null) : \Zend_Form_ElementCreate an element
| Name | Type | Description |
|---|---|---|
| $type | string | |
| $name | string | |
| $options | array | \Zend_Config |
| Type | Description |
|---|---|
| \Zend_Form_Element |

current() : \Zend_Form_Element | \Zend_Form_DisplayGroup | \Zend_FormCurrent element/subform/display group
| Type | Description |
|---|---|
| \Zend_Form_Element | \Zend_Form_DisplayGroup | \Zend_Form |

filterName(string $value, bool $allowBrackets = false) : stringFilter a name to only allow valid variable characters
| Name | Type | Description |
|---|---|---|
| $value | string | |
| $allowBrackets | bool |
| Type | Description |
|---|---|
| string |

getAttrib(string $key) : mixedRetrieve a single form attribute
| Name | Type | Description |
|---|---|---|
| $key | string |
| Type | Description |
|---|---|
| mixed |

getCustomMessages() : arrayRetrieve translated custom error messages Proxies to {@link _getErrorMessages()}.
| Type | Description |
|---|---|
| array |

getDecorator(string $name) : false | \Zend_Form_Decorator_AbstractRetrieve a registered decorator
| Name | Type | Description |
|---|---|---|
| $name | string |
| Type | Description |
|---|---|
| false | \Zend_Form_Decorator_Abstract |

getDefaultDisplayGroupClass() : stringRetrieve default display group class
| Type | Description |
|---|---|
| string |

getDefaultTranslator() : null | \Zend_TranslateGet global default translator object
| Type | Description |
|---|---|
| null | \Zend_Translate |

getDisplayGroup(string $name) : \Zend_Form_DisplayGroup | nullReturn a display group
| Name | Type | Description |
|---|---|---|
| $name | string |
| Type | Description |
|---|---|
| \Zend_Form_DisplayGroup | null |

getElement(string $name) : \Zend_Form_Element | nullRetrieve a single element
| Name | Type | Description |
|---|---|---|
| $name | string |
| Type | Description |
|---|---|
| \Zend_Form_Element | null |

getElementsAndSubFormsOrdered() : arrayReturns a one dimensional numerical indexed array with the Elements, SubForms and Elements from DisplayGroups as Values.
| Type | Description |
|---|---|
| array |
- Access
- protected

getElementsBelongTo() : string | nullGet name of array elements belong to
| Type | Description |
|---|---|
| string | null |

getErrors(string $name = null, $suppressArrayNotation = false) : arrayGet error codes for all elements failing validation
| Name | Type | Description |
|---|---|---|
| $name | string | |
| $suppressArrayNotation |
| Type | Description |
|---|---|
| array |

getFullyQualifiedName() : stringGet fully qualified name
| Type | Description |
|---|---|
| string |

getMessages(string $name = null, bool $suppressArrayNotation = false) : arrayRetrieve error messages from elements failing validations
| Name | Type | Description |
|---|---|---|
| $name | string | |
| $suppressArrayNotation | bool |
| Type | Description |
|---|---|
| array |

getPluginLoader(string $type = null) : \Zend_Loader_PluginLoader_InterfaceRetrieve plugin loader for given type
| Name | Type | Description |
|---|---|---|
| $type | string |
| Type | Description |
|---|---|
| \Zend_Loader_PluginLoader_Interface |

getSubForm(string $name) : \Zend_Form | nullRetrieve a form subForm/subform
| Name | Type | Description |
|---|---|---|
| $name | string |
| Type | Description |
|---|---|
| \Zend_Form | null |

getTranslator() : \Zend_Translate | nullRetrieve translator object
| Type | Description |
|---|---|
| \Zend_Translate | null |

getUnfilteredValue(string $name) : mixedGet unfiltered element value
| Name | Type | Description |
|---|---|---|
| $name | string |
| Type | Description |
|---|---|
| mixed |

getValidValues(array $data, bool $suppressArrayNotation = false) : arrayReturns only the valid values from the given form input.
| Name | Type | Description |
|---|---|---|
| $data | array | |
| $suppressArrayNotation | bool |
| Type | Description |
|---|---|
| array |

getValue(string $name) : mixedRetrieve value for single element
| Name | Type | Description |
|---|---|---|
| $name | string |
| Type | Description |
|---|---|
| mixed |

getValues(bool $suppressArrayNotation = false) : arrayRetrieve all form element values
| Name | Type | Description |
|---|---|---|
| $suppressArrayNotation | bool |
| Type | Description |
|---|---|
| array |

getView() : \Zend_View_Interface | nullRetrieve view object
| Type | Description |
|---|---|
| \Zend_View_Interface | null |

hasDefaultTranslator() : booleanIs there a default translation object set?
| Type | Description |
|---|---|
| boolean |

isErrors() : boolAre there errors in the form?
| Type | Description |
|---|---|
| bool |
- Deprecated
- since 1.11.1 - use hasErrors() instead

isValid(array $data) : booleanValidate the form
| Name | Type | Description |
|---|---|---|
| $data | array |
| Type | Description |
|---|---|
| boolean |

isValidPartial(array $data) : booleanValidate a partial form
| Name | Type | Description |
|---|---|---|
| $data | array |
| Type | Description |
|---|---|
| boolean |

loadDefaultDecoratorsIsDisabled() : boolShould we load the default decorators?
| Type | Description |
|---|---|
| bool |

markAsError() : \Zend_FormMark the element as being in a failed validation state
| Type | Description |
|---|---|
| \Zend_Form |

populate(array $values) : \Zend_FormPopulate form
| Name | Type | Description |
|---|---|---|
| $values | array |
| Type | Description |
|---|---|
| \Zend_Form |

processAjax(array $data) : stringProcess submitted AJAX data
| Name | Type | Description |
|---|---|---|
| $data | array |
| Type | Description |
|---|---|
| string | JSON-encoded boolean true or error messages |

removeAttrib(string $key) : boolRemove attribute
| Name | Type | Description |
|---|---|---|
| $key | string |
| Type | Description |
|---|---|
| bool |

removeDecorator(string $name) : boolRemove a single decorator
| Name | Type | Description |
|---|---|---|
| $name | string |
| Type | Description |
|---|---|
| bool |

removeDisplayGroup(string $name) : booleanRemove a display group by name
| Name | Type | Description |
|---|---|---|
| $name | string |
| Type | Description |
|---|---|
| boolean |

removeElement(string $name) : booleanRemove element
| Name | Type | Description |
|---|---|---|
| $name | string |
| Type | Description |
|---|---|
| boolean |

removeFromIteration(string $name) : voidRemove an element from iteration
| Name | Type | Description |
|---|---|---|
| $name | string | Element/group/form name |

removeSubForm(string $name) : booleanRemove form subForm/subform
| Name | Type | Description |
|---|---|---|
| $name | string |
| Type | Description |
|---|---|
| boolean |

render(\Zend_View_Interface $view = null) : stringRender form
| Name | Type | Description |
|---|---|---|
| $view | \Zend_View_Interface |
| Type | Description |
|---|---|
| string |

setAction(string $action) : \Zend_FormSet form action
| Name | Type | Description |
|---|---|---|
| $action | string |
| Type | Description |
|---|---|
| \Zend_Form |

setAttrib(string $key, mixed $value) : \Zend_FormSet form attribute
| Name | Type | Description |
|---|---|---|
| $key | string | |
| $value | mixed |
| Type | Description |
|---|---|
| \Zend_Form |

setAttribs(array $attribs) : \Zend_FormSet multiple form attributes at once
| Name | Type | Description |
|---|---|---|
| $attribs | array |
| Type | Description |
|---|---|
| \Zend_Form |

setConfig(\Zend_Config $config) : \Zend_FormSet form state from config object
| Name | Type | Description |
|---|---|---|
| $config | \Zend_Config |
| Type | Description |
|---|---|
| \Zend_Form |

setDecorators(array $decorators) : \Zend_FormOverwrite all decorators
| Name | Type | Description |
|---|---|---|
| $decorators | array |
| Type | Description |
|---|---|
| \Zend_Form |

setDefault(string $name, mixed $value) : \Zend_FormSet default value for an element
| Name | Type | Description |
|---|---|---|
| $name | string | |
| $value | mixed |
| Type | Description |
|---|---|
| \Zend_Form |

setDefaultDisplayGroupClass(string $class) : \Zend_FormSet default display group class
| Name | Type | Description |
|---|---|---|
| $class | string |
| Type | Description |
|---|---|
| \Zend_Form |

setDefaultTranslator(\Zend_Translate | \Zend_Translate_Adapter | null $translator = null) : voidSet global default translator object
| Name | Type | Description |
|---|---|---|
| $translator | \Zend_Translate | \Zend_Translate_Adapter | null |

setDefaults(array $defaults) : \Zend_FormSet default values for elements
| Name | Type | Description |
|---|---|---|
| $defaults | array |
| Type | Description |
|---|---|
| \Zend_Form |

setDescription(string $value) : \Zend_FormSet form description
| Name | Type | Description |
|---|---|---|
| $value | string |
| Type | Description |
|---|---|
| \Zend_Form |

setDisableLoadDefaultDecorators(bool $flag) : \Zend_FormSet flag to disable loading default decorators
| Name | Type | Description |
|---|---|---|
| $flag | bool |
| Type | Description |
|---|---|
| \Zend_Form |

setDisableTranslator(bool $flag) : \Zend_FormIndicate whether or not translation should be disabled
| Name | Type | Description |
|---|---|---|
| $flag | bool |
| Type | Description |
|---|---|
| \Zend_Form |

setDisplayGroupDecorators(array $decorators) : \Zend_FormSet all display group decorators as specified
| Name | Type | Description |
|---|---|---|
| $decorators | array |
| Type | Description |
|---|---|
| \Zend_Form |

setDisplayGroups(array $groups) : \Zend_FormAdd multiple display groups (overwrites)
| Name | Type | Description |
|---|---|---|
| $groups | array |
| Type | Description |
|---|---|
| \Zend_Form |

setElementDecorators(array $decorators, array | null $elements = null, bool $include = true) : \Zend_FormSet all element decorators as specified
| Name | Type | Description |
|---|---|---|
| $decorators | array | |
| $elements | array | null | Specific elements to decorate or exclude from decoration |
| $include | bool | Whether $elements is an inclusion or exclusion list |
| Type | Description |
|---|---|
| \Zend_Form |

setElementFilters(array $filters) : \Zend_FormSet all elements' filters
| Name | Type | Description |
|---|---|---|
| $filters | array |
| Type | Description |
|---|---|
| \Zend_Form |

setElements(array $elements) : \Zend_FormSet form elements (overwrites existing elements)
| Name | Type | Description |
|---|---|---|
| $elements | array |
| Type | Description |
|---|---|
| \Zend_Form |

setElementsBelongTo(string $array) : \Zend_FormSet name of array elements belong to
| Name | Type | Description |
|---|---|---|
| $array | string |
| Type | Description |
|---|---|
| \Zend_Form |

setEnctype(string $value) : \Zend_FormSet encoding type
| Name | Type | Description |
|---|---|---|
| $value | string |
| Type | Description |
|---|---|
| \Zend_Form |

setErrorMessages(array $messages) : \Zend_FormSame as addErrorMessages(), but clears custom error message stack first
| Name | Type | Description |
|---|---|---|
| $messages | array |
| Type | Description |
|---|---|
| \Zend_Form |

setErrors(array $messages) : \Zend_FormOverwrite any previously set error messages and flag as failed validation
| Name | Type | Description |
|---|---|---|
| $messages | array |
| Type | Description |
|---|---|
| \Zend_Form |

setIsArray(bool $flag) : \Zend_FormSet flag indicating elements belong to array
| Name | Type | Description |
|---|---|---|
| $flag | bool | Value of flag |
| Type | Description |
|---|---|
| \Zend_Form |

setLegend(string $value) : \Zend_FormSet form legend
| Name | Type | Description |
|---|---|---|
| $value | string |
| Type | Description |
|---|---|
| \Zend_Form |

setMethod(string $method) : \Zend_FormSet form method
| Name | Type | Description |
|---|---|---|
| $method | string |
| Type | Description |
|---|---|
| \Zend_Form |
| Exception | Description |
|---|---|
| \Zend_Form_Exception |

setName(string $name) : \Zend_FormSet form name
| Name | Type | Description |
|---|---|---|
| $name | string |
| Type | Description |
|---|---|
| \Zend_Form |

setOptions(array $options) : \Zend_FormSet form state from options array
| Name | Type | Description |
|---|---|---|
| $options | array |
| Type | Description |
|---|---|
| \Zend_Form |

setOrder(int $index) : \Zend_FormSet form order
| Name | Type | Description |
|---|---|---|
| $index | int |
| Type | Description |
|---|---|
| \Zend_Form |

setPluginLoader(\Zend_Loader_PluginLoader_Interface $loader, string $type = null) : \Zend_FormSet plugin loaders for use with decorators and elements
| Name | Type | Description |
|---|---|---|
| $loader | \Zend_Loader_PluginLoader_Interface | |
| $type | string | 'decorator' or 'element' |
| Type | Description |
|---|---|
| \Zend_Form |
| Exception | Description |
|---|---|
| \Zend_Form_Exception | on invalid type |

setSubFormDecorators(array $decorators) : \Zend_FormSet all subform decorators as specified
| Name | Type | Description |
|---|---|---|
| $decorators | array |
| Type | Description |
|---|---|
| \Zend_Form |

setSubForms(array $subForms) : \Zend_FormSet multiple form subForms/subforms (overwrites)
| Name | Type | Description |
|---|---|---|
| $subForms | array |
| Type | Description |
|---|---|
| \Zend_Form |

setTranslator(\Zend_Translate | \Zend_Translate_Adapter | null $translator = null) : \Zend_FormSet translator object
| Name | Type | Description |
|---|---|---|
| $translator | \Zend_Translate | \Zend_Translate_Adapter | null |
| Type | Description |
|---|---|
| \Zend_Form |

setView(\Zend_View_Interface $view = null) : \Zend_FormSet view object
| Name | Type | Description |
|---|---|---|
| $view | \Zend_View_Interface |
| Type | Description |
|---|---|
| \Zend_Form |