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_Elementmethod, 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:
[element] name = "foo" value = "foobar" label = "Foo:" order = 10 required = true allowEmpty = false autoInsertNotEmptyValidator = true description = "Foo elements are for examples" ignore = false attribs.id = "foo" attribs.class = "element" ; sets 'onclick' attribute onclick = "autoComplete(this, '/form/autocomplete/element')" prefixPaths.decorator.prefix = "My_Decorator" prefixPaths.decorator.path = "My/Decorator/" disableTranslator = 0 validators.required.validator = "NotEmpty" validators.required.breakChainOnFailure = true validators.alpha.validator = "alpha" validators.regex.validator = "regex" validators.regex.options.pattern = "/^[A-F].*/$" filters.ucase.filter = "StringToUpper" decorators.element.decorator = "ViewHelper" decorators.element.options.helper = "FormText" decorators.label.decorator = "Label"




