777. Class

777.1. Zend\Form\Form

777.1.1. Methods

777.1.1.1. add

add()

Add an element or fieldset

If $elementOrFieldset is an array or Traversable, passes the argument on to the composed factory to create the object before attaching it.

$flags could contain metadata such as the alias under which to register the element or fieldset, order in which to prioritize it, etc.

Parameters:
  • array|Traversable|ElementInterface
  • array
Return type:

ZendFormFieldset|ZendFormFieldsetInterface|ZendFormFormInterface

777.1.1.2. prepare

prepare()

Ensures state is ready for use

Marshalls the input filter, to ensure validation error messages are available, and prepares any elements and/or fieldsets that require preparation.

Return type:Form

777.1.1.3. setData

setData()

Set data to validate and/or populate elements

Typically, also passes data on to the composed input filter.

Parameters:array|ArrayAccess|Traversable
Return type:Form|FormInterface
Throws :ExceptionInvalidArgumentException

777.1.1.4. bind

bind()

Bind an object to the form

Ensures the object is populated with validated values.

Parameters:
  • object
  • int
Return type:

mixed|void

Throws :

ExceptionInvalidArgumentException

777.1.1.5. setHydrator

setHydrator()

Set the hydrator to use when binding an object to the element

Parameters:HydratorInterface
Return type:FieldsetInterface

777.1.1.6. bindValues

bindValues()

Bind values to the bound object

Parameters:array
Return type:mixed

777.1.1.7. prepareBindData

prepareBindData()

Parse filtered values and return only posted fields for binding

Parameters:
  • array
  • array
Return type:

array

777.1.1.8. setBindOnValidate

setBindOnValidate()

Set flag indicating whether or not to bind values on successful validation

Parameters:int
Return type:void|Form
Throws :ExceptionInvalidArgumentException

777.1.1.9. bindOnValidate

bindOnValidate()

Will we bind values to the bound object on successful validation?

Return type:bool

777.1.1.10. setBaseFieldset

setBaseFieldset()

Set the base fieldset to use when hydrating

Parameters:FieldsetInterface
Return type:Form
Throws :ExceptionInvalidArgumentException

777.1.1.11. getBaseFieldset

getBaseFieldset()

Get the base fieldset to use when hydrating

Return type:FieldsetInterface

777.1.1.12. hasValidated

hasValidated()

Check if the form has been validated

Return type:bool

777.1.1.13. isValid

isValid()

Validate the form

Typically, will proxy to the composed input filter.

Return type:bool
Throws :ExceptionDomainException

777.1.1.14. getData

getData()

Retrieve the validated data

By default, retrieves normalized values; pass one of the FormInterface::VALUES_* constants to shape the behavior.

Parameters:int
Return type:array|object
Throws :ExceptionDomainException

777.1.1.15. setValidationGroup

setValidationGroup()

Set the validation group (set of values to validate)

Typically, proxies to the composed input filter

Return type:Form|FormInterface

777.1.1.16. prepareValidationGroup

prepareValidationGroup()

Prepare the validation group in case Collection elements were used (this function also handle the case where elements could have been dynamically added or removed from a collection using JavaScript)

Parameters:
  • FieldsetInterface
  • array
  • array

777.1.1.17. setInputFilter

setInputFilter()

Set the input filter used by this form

Parameters:InputFilterInterface
Return type:FormInterface

777.1.1.18. getInputFilter

getInputFilter()

Retrieve input filter used by this form

Return type:null|InputFilterInterface

777.1.1.19. setUseInputFilterDefaults

setUseInputFilterDefaults()

Set flag indicating whether or not to scan elements and fieldsets for defaults

Parameters:bool
Return type:Form

777.1.1.20. useInputFilterDefaults

useInputFilterDefaults()

Should we use input filter defaults from elements and fieldsets?

Return type:bool

777.1.1.21. setPreferFormInputFilter

setPreferFormInputFilter()

Set flag indicating whether or not to prefer the form input filter over element and fieldset defaults

Parameters:bool
Return type:Form

777.1.1.22. getPreferFormInputFilter

getPreferFormInputFilter()

Should we use form input filter over element input filter defaults from elements and fieldsets?

Return type:bool

777.1.1.23. attachInputFilterDefaults

attachInputFilterDefaults()

Attach defaults provided by the elements to the input filter

Parameters:
  • InputFilterInterface
  • FieldsetInterface – Fieldset to traverse when looking for default inputs
Return type:

void

777.1.1.24. setWrapElements

setWrapElements()

Are the form elements/fieldsets names wrapped by the form name ?

Parameters:bool
Return type:Form

777.1.1.25. wrapElements

wrapElements()

If true, form elements/fieldsets name’s are wrapped around the form name itself

Return type:bool

777.1.1.26. extract

extract()

Recursively extract values for elements and sub-fieldsets, and populate form values

Return type:array