Zend Framework  1.12
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
Zend_Form Class Reference

Public Member Functions

 __construct ($options=null)
 Constructor.
 
 __clone ()
 Clone form object and all children.
 
 reset ()
 Reset values of form.
 
 init ()
 Initialize form (used by extending classes)
 
 setOptions (array $options)
 Set form state from options array.
 
 setConfig (Zend_Config $config)
 Set form state from config object.
 
 setPluginLoader (Zend_Loader_PluginLoader_Interface $loader, $type=null)
 Set plugin loaders for use with decorators and elements.
 
 getPluginLoader ($type=null)
 Retrieve plugin loader for given type.
 
 addPrefixPath ($prefix, $path, $type=null)
 Add prefix path for plugin loader.
 
 addPrefixPaths (array $spec)
 Add many prefix paths at once.
 
 addElementPrefixPath ($prefix, $path, $type=null)
 Add prefix path for all elements.
 
 addElementPrefixPaths (array $spec)
 Add prefix paths for all elements.
 
 addDisplayGroupPrefixPath ($prefix, $path)
 Add prefix path for all display groups.
 
 addDisplayGroupPrefixPaths (array $spec)
 Add multiple display group prefix paths at once.
 
 setAttrib ($key, $value)
 Set form attribute.
 
 addAttribs (array $attribs)
 Add multiple form attributes at once.
 
 setAttribs (array $attribs)
 Set multiple form attributes at once.
 
 getAttrib ($key)
 Retrieve a single form attribute.
 
 getAttribs ()
 Retrieve all form attributes/metadata.
 
 removeAttrib ($key)
 Remove attribute.
 
 clearAttribs ()
 Clear all form attributes.
 
 setAction ($action)
 Set form action.
 
 getAction ()
 Get form action.
 
 setMethod ($method)
 Set form method.
 
 getMethod ()
 Retrieve form method.
 
 setEnctype ($value)
 Set encoding type.
 
 getEnctype ()
 Get encoding type.
 
 filterName ($value, $allowBrackets=false)
 Filter a name to only allow valid variable characters.
 
 setName ($name)
 Set form name.
 
 getName ()
 Get name attribute.
 
 getFullyQualifiedName ()
 Get fully qualified name.
 
 getId ()
 Get element id.
 
 setLegend ($value)
 Set form legend.
 
 getLegend ()
 Get form legend.
 
 setDescription ($value)
 Set form description.
 
 getDescription ()
 Retrieve form description.
 
 setOrder ($index)
 Set form order.
 
 getOrder ()
 Get form order.
 
 addElement ($element, $name=null, $options=null)
 Add a new element.
 
 createElement ($type, $name, $options=null)
 Create an element.
 
 addElements (array $elements)
 Add multiple elements at once.
 
 setElements (array $elements)
 Set form elements (overwrites existing elements)
 
 getElement ($name)
 Retrieve a single element.
 
 getElements ()
 Retrieve all elements.
 
 removeElement ($name)
 Remove element.
 
 clearElements ()
 Remove all form elements.
 
 setDefaults (array $defaults)
 Set default values for elements.
 
 setDefault ($name, $value)
 Set default value for an element.
 
 getValue ($name)
 Retrieve value for single element.
 
 getValues ($suppressArrayNotation=false)
 Retrieve all form element values.
 
 getValidValues ($data, $suppressArrayNotation=false)
 Returns only the valid values from the given form input.
 
 getUnfilteredValue ($name)
 Get unfiltered element value.
 
 getUnfilteredValues ()
 Retrieve all unfiltered element values.
 
 setElementFilters (array $filters)
 Set all elements' filters.
 
 setElementsBelongTo ($array)
 Set name of array elements belong to.
 
 getElementsBelongTo ()
 Get name of array elements belong to.
 
 setIsArray ($flag)
 Set flag indicating elements belong to array.
 
 isArray ()
 Get flag indicating if elements belong to an array.
 
 addSubForm (Zend_Form $form, $name, $order=null)
 Add a form group/subform.
 
 addSubForms (array $subForms)
 Add multiple form subForms/subforms at once.
 
 setSubForms (array $subForms)
 Set multiple form subForms/subforms (overwrites)
 
 getSubForm ($name)
 Retrieve a form subForm/subform.
 
 getSubForms ()
 Retrieve all form subForms/subforms.
 
 removeSubForm ($name)
 Remove form subForm/subform.
 
 clearSubForms ()
 Remove all form subForms/subforms.
 
 setDefaultDisplayGroupClass ($class)
 Set default display group class.
 
 getDefaultDisplayGroupClass ()
 Retrieve default display group class.
 
 addDisplayGroup (array $elements, $name, $options=null)
 Add a display group.
 
 addDisplayGroups (array $groups)
 Add multiple display groups at once.
 
 setDisplayGroups (array $groups)
 Add multiple display groups (overwrites)
 
 getDisplayGroup ($name)
 Return a display group.
 
 getDisplayGroups ()
 Return all display groups.
 
 removeDisplayGroup ($name)
 Remove a display group by name.
 
 clearDisplayGroups ()
 Remove all display groups.
 
 populate (array $values)
 Populate form.
 
 getElementsAndSubFormsOrdered ()
 Returns a one dimensional numerical indexed array with the Elements, SubForms and Elements from DisplayGroups as Values.
 
 isValid ($data)
 Validate the form.
 
 isValidPartial (array $data)
 Validate a partial form.
 
 processAjax (array $data)
 Process submitted AJAX data.
 
 addErrorMessage ($message)
 Add a custom error message to return in the event of failed validation.
 
 addErrorMessages (array $messages)
 Add multiple custom error messages to return in the event of failed validation.
 
 setErrorMessages (array $messages)
 Same as addErrorMessages(), but clears custom error message stack first.
 
 getErrorMessages ()
 Retrieve custom error messages.
 
 clearErrorMessages ()
 Clear custom error messages stack.
 
 markAsError ()
 Mark the element as being in a failed validation state.
 
 addError ($message)
 Add an error message and mark element as failed validation.
 
 addErrors (array $messages)
 Add multiple error messages and flag element as failed validation.
 
 setErrors (array $messages)
 Overwrite any previously set error messages and flag as failed validation.
 
 persistData ()
 
 isErrors ()
 Are there errors in the form?
 
 hasErrors ()
 Are there errors in the form?
 
 getErrors ($name=null, $suppressArrayNotation=false)
 Get error codes for all elements failing validation.
 
 getMessages ($name=null, $suppressArrayNotation=false)
 Retrieve error messages from elements failing validations.
 
 getCustomMessages ()
 Retrieve translated custom error messages Proxies to _getErrorMessages().
 
 setView (Zend_View_Interface $view=null)
 Set view object.
 
 getView ()
 Retrieve view object.
 
 addDecorator ($decorator, $options=null)
 Add a decorator for rendering the element.
 
 addDecorators (array $decorators)
 Add many decorators at once.
 
 setDecorators (array $decorators)
 Overwrite all decorators.
 
 getDecorator ($name)
 Retrieve a registered decorator.
 
 getDecorators ()
 Retrieve all decorators.
 
 removeDecorator ($name)
 Remove a single decorator.
 
 clearDecorators ()
 Clear all decorators.
 
 setElementDecorators (array $decorators, array $elements=null, $include=true)
 Set all element decorators as specified.
 
 setDisplayGroupDecorators (array $decorators)
 Set all display group decorators as specified.
 
 setSubFormDecorators (array $decorators)
 Set all subform decorators as specified.
 
 render (Zend_View_Interface $view=null)
 Render form.
 
 __toString ()
 Serialize as string.
 
 setTranslator ($translator=null)
 Set translator object.
 
 getTranslator ()
 Retrieve translator object.
 
 hasTranslator ()
 Does this form have its own specific translator?
 
 setDisableTranslator ($flag)
 Indicate whether or not translation should be disabled.
 
 translatorIsDisabled ()
 Is translation disabled?
 
 __get ($name)
 Overloading: access to elements, form groups, and display groups.
 
 __set ($name, $value)
 Overloading: access to elements, form groups, and display groups.
 
 __isset ($name)
 Overloading: access to elements, form groups, and display groups.
 
 __unset ($name)
 Overloading: access to elements, form groups, and display groups.
 
 __call ($method, $args)
 Overloading: allow rendering specific decorators.
 
 current ()
 Current element/subform/display group.
 
 key ()
 Current element/subform/display group name.
 
 next ()
 Move pointer to next element/subform/display group.
 
 rewind ()
 Move pointer to beginning of element/subform/display group loop.
 
 valid ()
 Determine if current element/subform/display group is valid.
 
 count ()
 Count of elements/subforms that are iterable.
 
 setDisableLoadDefaultDecorators ($flag)
 Set flag to disable loading default decorators.
 
 loadDefaultDecoratorsIsDisabled ()
 Should we load the default decorators?
 
 loadDefaultDecorators ()
 Load the default decorators.
 
 removeFromIteration ($name)
 Remove an element from iteration.
 
- Public Member Functions inherited from Zend_Validate_Interface
 getMessages ()
 Returns an array of messages that explain why the most recent isValid() call returned false.
 

Static Public Member Functions

static setDefaultTranslator ($translator=null)
 Set global default translator object.
 
static getDefaultTranslator ()
 Get global default translator object.
 
static hasDefaultTranslator ()
 Is there a default translation object set?
 

Public Attributes

const DECORATOR = 'DECORATOR'
 #@+ Plugin loader type constants
 
const ELEMENT = 'ELEMENT'
 
const METHOD_DELETE = 'delete'
 #@-
 
const METHOD_GET = 'get'
 
const METHOD_POST = 'post'
 
const METHOD_PUT = 'put'
 
const ENCTYPE_URLENCODED = 'application/x-www-form-urlencoded'
 #@-
 
const ENCTYPE_MULTIPART = 'multipart/form-data'
 

Protected Member Functions

 _setIsRendered ()
 When calling renderFormElements or render this method is used to set $_isRendered member to prevent repeatedly merging belongsTo setting.
 
 _getIsRendered ()
 Get the value of $_isRendered member.
 
 _setElementsBelongTo ($name=null)
 Set array to which elements belong.
 
 _addDisplayGroupObject (Zend_Form_DisplayGroup $group, $name=null)
 Add a display group object (used with cloning)
 
 _getArrayName ($value)
 Determine array key name from given value.
 
 _dissolveArrayValue ($value, $arrayPath)
 Extract the value by walking the array using given array path.
 
 _dissolveArrayUnsetKey ($array, $arrayPath, $key)
 Given an array, an optional arrayPath and a key this method dissolves the arrayPath and unsets the key within the array if it exists.
 
 _attachToArray ($value, $arrayPath)
 Converts given arrayPath to an array and attaches given value at the end of it.
 
 _array_replace_recursive (array $into)
 This is a helper function until php 5.3 is widespreaded.
 
 _getDecorator ($name, $options)
 Instantiate a decorator based on class name or class name fragment.
 
 _sort ()
 Sort items according to their order.
 
 _loadDecorator (array $decorator, $name)
 Lazy-load a decorator.
 
 _getErrorMessages ()
 Retrieve optionally translated custom error messages.
 

Protected Attributes

 $_attribs = array()
 
 $_decorators = array()
 
 $_defaultDisplayGroupClass = 'Zend_Form_DisplayGroup'
 
 $_description
 
 $_disableLoadDefaultDecorators = false
 
 $_displayGroupPrefixPaths = array()
 
 $_displayGroups = array()
 
 $_elementDecorators
 
 $_elementPrefixPaths = array()
 
 $_elements = array()
 
 $_elementsBelongTo
 
 $_errorMessages = array()
 
 $_errorsExist = false
 
 $_errorsForced = false
 
 $_formOrder
 
 $_isArray = false
 
 $_legend
 
 $_loaders = array()
 
 $_methods = array('delete', 'get', 'post', 'put')
 
 $_order = array()
 
 $_orderUpdated = false
 
 $_subFormPrefixPaths = array()
 
 $_subForms = array()
 
 $_translator
 
 $_translatorDisabled = false
 
 $_view
 
 $_isRendered = false
 

Static Protected Attributes

static $_translatorDefault
 

Constructor & Destructor Documentation

__construct (   $options = null)

Constructor.

Registers form view helper as decorator

Parameters
mixed$options
Returns
void

Member Function Documentation

__call (   $method,
  $args 
)

Overloading: allow rendering specific decorators.

Call renderDecoratorName() to render a specific decorator.

Parameters
string$method
array$args
Returns
string
Exceptions
Zend_Form_Exceptionfor invalid decorator or invalid method call
__clone ( )

Clone form object and all children.

Returns
void
__get (   $name)

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

Parameters
string$name
Returns
Zend_Form_Element|Zend_Form|null
__isset (   $name)

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

Parameters
string$name
Returns
boolean
__set (   $name,
  $value 
)

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

Parameters
string$name
Zend_Form_Element | Zend_Form$value
Returns
void
Exceptions
Zend_Form_Exceptionfor invalid $value
__toString ( )

Serialize as string.

Proxies to render().

Returns
string
__unset (   $name)

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

Parameters
string$name
Returns
void
_addDisplayGroupObject ( Zend_Form_DisplayGroup  $group,
  $name = null 
)
protected

Add a display group object (used with cloning)

Parameters
Zend_Form_DisplayGroup$group
string | null$name
Returns
Zend_Form
_array_replace_recursive ( array  $into)
protected

This is a helper function until php 5.3 is widespreaded.

Parameters
array$intoprotected
Returns
void
_attachToArray (   $value,
  $arrayPath 
)
protected

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

Parameters
mixed$valueThe value to attach
string$arrayPathGiven array path to convert and attach to.
Returns
array
_dissolveArrayUnsetKey (   $array,
  $arrayPath,
  $key 
)
protected

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

Parameters
array$array
string | null$arrayPath
string$key
Returns
array
_dissolveArrayValue (   $value,
  $arrayPath 
)
protected

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

Parameters
array$valueArray to walk
string$arrayPathArray notation path of the part to extract
Returns
string
_getArrayName (   $value)
protected

Determine array key name from given value.

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

Parameters
string$value
Returns
string
_getDecorator (   $name,
  $options 
)
protected

Instantiate a decorator based on class name or class name fragment.

Parameters
string$name
null | array$options
Returns
Zend_Form_Decorator_Interface
_getErrorMessages ( )
protected

Retrieve optionally translated custom error messages.

Returns
array
_getIsRendered ( )
protected

Get the value of $_isRendered member.

_loadDecorator ( array  $decorator,
  $name 
)
protected

Lazy-load a decorator.

Parameters
array$decoratorDecorator type and options
mixed$nameDecorator name or alias
Returns
Zend_Form_Decorator_Interface
_setElementsBelongTo (   $name = null)
protected

Set array to which elements belong.

Parameters
string$nameElement name
Returns
void
_setIsRendered ( )
protected

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

_sort ( )
protected

Sort items according to their order.

Returns
void
addAttribs ( array  $attribs)

Add multiple form attributes at once.

Parameters
array$attribs
Returns
Zend_Form
addDecorator (   $decorator,
  $options = null 
)

Add a decorator for rendering the element.

Parameters
string | Zend_Form_Decorator_Interface$decorator
array | Zend_Config$optionsOptions with which to initialize decorator
Returns
Zend_Form
addDecorators ( array  $decorators)

Add many decorators at once.

Parameters
array$decorators
Returns
Zend_Form
addDisplayGroup ( array  $elements,
  $name,
  $options = null 
)

Add a display group.

Groups named elements for display purposes.

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

Parameters
array$elements
string$name
array | Zend_Config$options
Returns
Zend_Form
Exceptions
Zend_Form_Exceptionif no valid elements provided
addDisplayGroupPrefixPath (   $prefix,
  $path 
)

Add prefix path for all display groups.

Parameters
string$prefix
string$path
Returns
Zend_Form
addDisplayGroupPrefixPaths ( array  $spec)

Add multiple display group prefix paths at once.

Parameters
array$spec
Returns
Zend_Form
addDisplayGroups ( array  $groups)

Add multiple display groups at once.

Parameters
array$groups
Returns
Zend_Form
addElement (   $element,
  $name = null,
  $options = null 
)

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.

Parameters
string | Zend_Form_Element$element
string$name
array | Zend_Config$options
Exceptions
Zend_Form_Exceptionon invalid element
Returns
Zend_Form
addElementPrefixPath (   $prefix,
  $path,
  $type = null 
)

Add prefix path for all elements.

Parameters
string$prefix
string$path
string$type
Returns
Zend_Form
addElementPrefixPaths ( array  $spec)

Add prefix paths for all elements.

Parameters
array$spec
Returns
Zend_Form
addElements ( array  $elements)

Add multiple elements at once.

Parameters
array$elements
Returns
Zend_Form
addError (   $message)

Add an error message and mark element as failed validation.

Parameters
string$message
Returns
Zend_Form
addErrorMessage (   $message)

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

Parameters
string$message
Returns
Zend_Form
addErrorMessages ( array  $messages)

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

Parameters
array$messages
Returns
Zend_Form
addErrors ( array  $messages)

Add multiple error messages and flag element as failed validation.

Parameters
array$messages
Returns
Zend_Form
addPrefixPath (   $prefix,
  $path,
  $type = null 
)

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/'

Parameters
string$prefix
string$path
string$type
Returns
Zend_Form
Exceptions
Zend_Form_Exceptionfor invalid type
addPrefixPaths ( array  $spec)

Add many prefix paths at once.

Parameters
array$spec
Returns
Zend_Form
addSubForm ( Zend_Form  $form,
  $name,
  $order = null 
)

Add a form group/subform.

Parameters
Zend_Form$form
string$name
int$order
Returns
Zend_Form
addSubForms ( array  $subForms)

Add multiple form subForms/subforms at once.

Parameters
array$subForms
Returns
Zend_Form
clearAttribs ( )

Clear all form attributes.

Returns
Zend_Form
clearDecorators ( )

Clear all decorators.

Returns
Zend_Form
clearDisplayGroups ( )

Remove all display groups.

Returns
Zend_Form
clearElements ( )

Remove all form elements.

Returns
Zend_Form
clearErrorMessages ( )

Clear custom error messages stack.

Returns
Zend_Form
clearSubForms ( )

Remove all form subForms/subforms.

Returns
Zend_Form
count ( )

Count of elements/subforms that are iterable.

Returns
int
createElement (   $type,
  $name,
  $options = null 
)

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

Parameters
string$type
string$name
array | Zend_Config$options
Returns
Zend_Form_Element
current ( )

Current element/subform/display group.

Returns
Zend_Form_Element|Zend_Form_DisplayGroup|Zend_Form
filterName (   $value,
  $allowBrackets = false 
)

Filter a name to only allow valid variable characters.

Parameters
string$value
bool$allowBrackets
Returns
string
getAction ( )

Get form action.

Sets default to '' if not set.

Returns
string
getAttrib (   $key)

Retrieve a single form attribute.

Parameters
string$key
Returns
mixed
getAttribs ( )

Retrieve all form attributes/metadata.

Returns
array
getCustomMessages ( )

Retrieve translated custom error messages Proxies to _getErrorMessages().

Returns
array
getDecorator (   $name)

Retrieve a registered decorator.

Parameters
string$name
Returns
false|Zend_Form_Decorator_Abstract
getDecorators ( )

Retrieve all decorators.

Returns
array
getDefaultDisplayGroupClass ( )

Retrieve default display group class.

Returns
string
static getDefaultTranslator ( )
static

Get global default translator object.

Returns
null|Zend_Translate
getDescription ( )

Retrieve form description.

Returns
string
getDisplayGroup (   $name)

Return a display group.

Parameters
string$name
Returns
Zend_Form_DisplayGroup|null
getDisplayGroups ( )

Return all display groups.

Returns
array
getElement (   $name)

Retrieve a single element.

Parameters
string$name
Returns
Zend_Form_Element|null
getElements ( )

Retrieve all elements.

Returns
array
getElementsAndSubFormsOrdered ( )

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.

protected

Returns
array
getElementsBelongTo ( )

Get name of array elements belong to.

Returns
string|null
getEnctype ( )

Get encoding type.

Returns
string
getErrorMessages ( )

Retrieve custom error messages.

Returns
array
getErrors (   $name = null,
  $suppressArrayNotation = false 
)

Get error codes for all elements failing validation.

Parameters
string$name
Returns
array
getFullyQualifiedName ( )

Get fully qualified name.

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

Returns
string
getId ( )

Get element id.

Returns
string
getLegend ( )

Get form legend.

Returns
string
getMessages (   $name = null,
  $suppressArrayNotation = false 
)

Retrieve error messages from elements failing validations.

Parameters
string$name
bool$suppressArrayNotation
Returns
array
getMethod ( )

Retrieve form method.

Returns
string
getName ( )

Get name attribute.

Returns
null|string
getOrder ( )

Get form order.

Returns
int|null
getPluginLoader (   $type = null)

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.

Parameters
string$type
Returns
Zend_Loader_PluginLoader_Interface
getSubForm (   $name)

Retrieve a form subForm/subform.

Parameters
string$name
Returns
Zend_Form|null
getSubForms ( )

Retrieve all form subForms/subforms.

Returns
array
getTranslator ( )

Retrieve translator object.

Returns
Zend_Translate|null
getUnfilteredValue (   $name)

Get unfiltered element value.

Parameters
string$name
Returns
mixed
getUnfilteredValues ( )

Retrieve all unfiltered element values.

Returns
array
getValidValues (   $data,
  $suppressArrayNotation = false 
)

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.

Parameters
array$data
bool$suppressArrayNotation
Returns
array
getValue (   $name)

Retrieve value for single element.

Parameters
string$name
Returns
mixed
getValues (   $suppressArrayNotation = false)

Retrieve all form element values.

Parameters
bool$suppressArrayNotation
Returns
array
getView ( )

Retrieve view object.

If none registered, attempts to pull from ViewRenderer.

Returns
Zend_View_Interface|null
static hasDefaultTranslator ( )
static

Is there a default translation object set?

Returns
boolean
hasErrors ( )

Are there errors in the form?

Returns
bool
hasTranslator ( )

Does this form have its own specific translator?

Returns
bool
init ( )

Initialize form (used by extending classes)

Returns
void
isArray ( )

Get flag indicating if elements belong to an array.

Returns
bool
isErrors ( )

Are there errors in the form?

Deprecated:
since 1.11.1 - use hasErrors() instead
Returns
bool
isValid (   $data)

Validate the form.

Parameters
array$data
Returns
boolean

Implements Zend_Validate_Interface.

isValidPartial ( array  $data)

Validate a partial form.

Does not check for required flags.

Parameters
array$data
Returns
boolean
key ( )

Current element/subform/display group name.

Returns
string
loadDefaultDecorators ( )

Load the default decorators.

Returns
Zend_Form
loadDefaultDecoratorsIsDisabled ( )

Should we load the default decorators?

Returns
bool
markAsError ( )

Mark the element as being in a failed validation state.

Returns
Zend_Form
next ( )

Move pointer to next element/subform/display group.

Returns
void
persistData ( )
populate ( array  $values)

Populate form.

Proxies to setDefaults()

Parameters
array$values
Returns
Zend_Form
processAjax ( array  $data)

Process submitted AJAX data.

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

Parameters
array$data
Returns
string JSON-encoded boolean true or error messages
removeAttrib (   $key)

Remove attribute.

Parameters
string$key
Returns
bool
removeDecorator (   $name)

Remove a single decorator.

Parameters
string$name
Returns
bool
removeDisplayGroup (   $name)

Remove a display group by name.

Parameters
string$name
Returns
boolean
removeElement (   $name)

Remove element.

Parameters
string$name
Returns
boolean
removeFromIteration (   $name)

Remove an element from iteration.

Parameters
string$nameElement/group/form name
Returns
void
removeSubForm (   $name)

Remove form subForm/subform.

Parameters
string$name
Returns
boolean
render ( Zend_View_Interface  $view = null)

Render form.

Parameters
Zend_View_Interface$view
Returns
string
reset ( )

Reset values of form.

Returns
Zend_Form
rewind ( )

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

Returns
void
setAction (   $action)

Set form action.

Parameters
string$action
Returns
Zend_Form
setAttrib (   $key,
  $value 
)

Set form attribute.

Parameters
string$key
mixed$value
Returns
Zend_Form
setAttribs ( array  $attribs)

Set multiple form attributes at once.

Overwrites any previously set attributes.

Parameters
array$attribs
Returns
Zend_Form
setConfig ( Zend_Config  $config)

Set form state from config object.

Parameters
Zend_Config$config
Returns
Zend_Form
setDecorators ( array  $decorators)

Overwrite all decorators.

Parameters
array$decorators
Returns
Zend_Form
setDefault (   $name,
  $value 
)

Set default value for an element.

Parameters
string$name
mixed$value
Returns
Zend_Form
setDefaultDisplayGroupClass (   $class)

Set default display group class.

Parameters
string$class
Returns
Zend_Form
setDefaults ( array  $defaults)

Set default values for elements.

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

Parameters
array$defaults
Returns
Zend_Form
static setDefaultTranslator (   $translator = null)
static

Set global default translator object.

Parameters
Zend_Translate | Zend_Translate_Adapter | null$translator
Returns
void
setDescription (   $value)

Set form description.

Parameters
string$value
Returns
Zend_Form
setDisableLoadDefaultDecorators (   $flag)

Set flag to disable loading default decorators.

Parameters
bool$flag
Returns
Zend_Form
setDisableTranslator (   $flag)

Indicate whether or not translation should be disabled.

Parameters
bool$flag
Returns
Zend_Form
setDisplayGroupDecorators ( array  $decorators)

Set all display group decorators as specified.

Parameters
array$decorators
Returns
Zend_Form
setDisplayGroups ( array  $groups)

Add multiple display groups (overwrites)

Parameters
array$groups
Returns
Zend_Form
setElementDecorators ( array  $decorators,
array  $elements = null,
  $include = true 
)

Set all element decorators as specified.

Parameters
array$decorators
array | null$elementsSpecific elements to decorate or exclude from decoration
bool$includeWhether $elements is an inclusion or exclusion list
Returns
Zend_Form
setElementFilters ( array  $filters)

Set all elements' filters.

Parameters
array$filters
Returns
Zend_Form
setElements ( array  $elements)

Set form elements (overwrites existing elements)

Parameters
array$elements
Returns
Zend_Form
setElementsBelongTo (   $array)

Set name of array elements belong to.

Parameters
string$array
Returns
Zend_Form
setEnctype (   $value)

Set encoding type.

Parameters
string$value
Returns
Zend_Form
setErrorMessages ( array  $messages)

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

Parameters
array$messages
Returns
Zend_Form
setErrors ( array  $messages)

Overwrite any previously set error messages and flag as failed validation.

Parameters
array$messages
Returns
Zend_Form
setIsArray (   $flag)

Set flag indicating elements belong to array.

Parameters
bool$flagValue of flag
Returns
Zend_Form
setLegend (   $value)

Set form legend.

Parameters
string$value
Returns
Zend_Form
setMethod (   $method)

Set form method.

Only values in $_methods() allowed

Parameters
string$method
Returns
Zend_Form
Exceptions
Zend_Form_Exception
setName (   $name)

Set form name.

Parameters
string$name
Returns
Zend_Form
setOptions ( array  $options)

Set form state from options array.

Parameters
array$options
Returns
Zend_Form
setOrder (   $index)

Set form order.

Parameters
int$index
Returns
Zend_Form
setPluginLoader ( Zend_Loader_PluginLoader_Interface  $loader,
  $type = null 
)

Set plugin loaders for use with decorators and elements.

Parameters
Zend_Loader_PluginLoader_Interface$loader
string$type'decorator' or 'element'
Returns
Zend_Form
Exceptions
Zend_Form_Exceptionon invalid type
setSubFormDecorators ( array  $decorators)

Set all subform decorators as specified.

Parameters
array$decorators
Returns
Zend_Form
setSubForms ( array  $subForms)

Set multiple form subForms/subforms (overwrites)

Parameters
array$subForms
Returns
Zend_Form
setTranslator (   $translator = null)

Set translator object.

Parameters
Zend_Translate | Zend_Translate_Adapter | null$translator
Returns
Zend_Form
setView ( Zend_View_Interface  $view = null)

Set view object.

Parameters
Zend_View_Interface$view
Returns
Zend_Form
translatorIsDisabled ( )

Is translation disabled?

Returns
bool
valid ( )

Determine if current element/subform/display group is valid.

Returns
bool

Member Data Documentation

$_attribs = array()
protected
$_decorators = array()
protected
$_defaultDisplayGroupClass = 'Zend_Form_DisplayGroup'
protected
$_description
protected
$_disableLoadDefaultDecorators = false
protected
$_displayGroupPrefixPaths = array()
protected
$_displayGroups = array()
protected
$_elementDecorators
protected
$_elementPrefixPaths = array()
protected
$_elements = array()
protected
$_elementsBelongTo
protected
$_errorMessages = array()
protected
$_errorsExist = false
protected
$_errorsForced = false
protected
$_formOrder
protected
$_isArray = false
protected
$_isRendered = false
protected
$_legend
protected
$_loaders = array()
protected
$_methods = array('delete', 'get', 'post', 'put')
protected
$_order = array()
protected
$_orderUpdated = false
protected
$_subFormPrefixPaths = array()
protected
$_subForms = array()
protected
$_translator
protected
$_translatorDefault
staticprotected
$_translatorDisabled = false
protected
$_view
protected
const DECORATOR = 'DECORATOR'

#@+ Plugin loader type constants

const ELEMENT = 'ELEMENT'
const ENCTYPE_MULTIPART = 'multipart/form-data'
const ENCTYPE_URLENCODED = 'application/x-www-form-urlencoded'

#@-

#@+ Encoding type constants

const METHOD_DELETE = 'delete'

#@-

#@+ Method type constants

const METHOD_GET = 'get'
const METHOD_POST = 'post'
const METHOD_PUT = 'put'