Tiger_Form

@api · extends Zend_Form

Tiger_Form — base class for every Tiger form.

Forms are Zend_Form subclasses configured with ARRAY config (never .ini), and they're AJAX-submitted: the VIEW owns all markup, so the base strips element decorators to ViewHelper-only. A subclass declares just its elements — either declaratively via elements() (preferred, most human-readable), or imperatively via build() with addElement() calls:

class Billing_Form_Invoice extends Tiger_Form { protected function elements(): array { return [ ['text', 'amount', [ 'required' => true, 'filters' => ['StringTrim'], 'validators' => [['Float']], 'attribs' => ['class' => 'form-control', 'placeholder' => $this->_t('invoice.amount')], ]], ['textarea', 'memo', [ 'filters' => ['StringTrim', 'StripTags'], 'attribs' => ['class' => 'form-control', 'rows' => 3], ]], ]; } }

Baked in for every form: POST method, ViewHelper-only decorators, a translate closure ($this->_t('some.key')), and CSRF (a hidden token element; override csrf() to disable for an idempotent search/filter form). Validate in a service with isValid()/isValidPartial() — see Tiger_Service_Service::_transaction() for the canonical validate-then-transaction flow.

Methods

init()

init()

Build the form: POST method, ViewHelper-only decorators, CSRF, translate helper, and the declared elements.

convenienceValidate()

convenienceValidate(string $name, $value, array $context = []): array

Convenience validation: validate ONE field against $value, returning the first error. This is the server-side check TigerValidateJS runs on blur — the same validators that run at submit, applied per-field as you tab through the form, so a value is known-good before the user ever clicks the button. $context is the rest of the posted form, so cross-field validators (e.g. a password-confirm Identical, a NoRecordExists uniqueness check) have what they need. Unknown/CSRF field → valid (never block on those; the real isValid() at submit is still authoritative).

  • $name string
  • $value mixed
  • $context array — the other submitted field values

Returns array