Skip to content
Tim Curzon edited this page Feb 28, 2022 · 2 revisions

Ztal Form

Ztal can happily process Zend_Form instances without issue but Zend_Form does a lot of work setting up translation and decorators that Ztal has no use for. Ztal\Form is a very small subclass of Zend_Form that will automatically disable decorator initialisation on any elements added to the form via the normal methods and will also disable translation setup for the form itself. In all other respects, Ztal\Form behaves exactly like the parent Zend_Form.

When writing new form subclasses it is recommended to subclass from Ztal\Form rather than Zend_Form and replacing Zend_Form with Ztal\Form is usually also the quickest way to start a migration of existing Zend_Form subclasses.

Decorators are not supported by Ztal as they are a terrible idea that breaks the entire MVC concept. Additionally, Ztal does not support arbitrary attributes on elements. However a number of standard attributes are supported on elements and there is support for defining the name of a custom macro to use when rendering an element.

Supported Attributes

All elements

  • class - The class(es) for the form element
  • macro - The path for a custom macro to render the element
  • errorMacro - The path for a custom macro to render errors for the element

Input element

  • maxlength
  • autocomplete

Textarea element

  • rows
  • cols

Select and Multiselect elements

  • sort - Apply a sort to the select options after translation. Uses the sort tale.

Button

  • type