This line was removed.
This word was removed. This word was added.
This line was added.

Changes (1)

View Page History

h2. Configuration

Zend_Form_Element's constructor accepts either an array of options or a Zend_Config object containing options, and it can also be configured using either setOptions() or setConfig(). Generally speaking, keys are named as follows:

* If 'set' + key refers to a Zend_Form_Element method, then the value provided will be passed to that method.
* Otherwise, the value will be used to set an attribute.

Exceptions to the rule include the following:

* prefixPath will be passed to addPrefixPaths()
* The following setters cannot be set in this way:
** setAttrib (though setAttribs *will* work)
** setConfig
** setOptions
** setPluginLoader
** setTranslator
** setView

As an example, here is a config file that passes configuration for every type of configurable data:

name = "foo"
value = "foobar"
label = "Foo:"
order = 10
required = true
description = "Foo elements are for examples" = "foo"
attribs.class = "element"
onclick = "autoComplete(this, '/form/autocomplete/element')" ; sets 'onclick' attribute
prefixPaths.decorator.prefix = "My_Decorator"
prefixPaths.decorator.path = "My/Decorator/"
validators.required.validator = "NotEmpty"
validators.required.breakChainOnFailure = true
validators.alpha.validator = "alpha"
validators.regex.validator = "regex"
validators.regex.options.pattern = "/^[a-f].*/i$"
filters.ucase.filter = "StringToUpper"
decorators.element.decorator = "ViewHelper"
decorators.element.options.helper = "FormText"
decorators.label.decorator = "Label"

h2. Custom elements