-- [email protected] <[email protected]> wrote
(on Thursday, 05 March 2009, 09:19 PM +0000):
> Also, with the Zend_Form ViewScript decorator, I thought I would be able to
> access the form object with something like $this->form from within the view.
>
> But I'm not able to access it. How would I be able to access for instance
> Zend_Form::getMethod(), Zend_Form::getEncType() and other (userland)
> attributes
> from within the ViewScript?
Since ViewScript may be used with forms, decorators, sub forms, or
elements, the key registered is simply "element". To avoid confusion,
usually the first thing I do is assign it to a locally scoped variable:
<?php $form = $this->element ?>
and then you can simply pull things as you need them:
$form->getMethod(), foreach ($form->getElements() as $element), etc.
--
Matthew Weier O'Phinney
Software Architect | [email protected]
Zend Framework | http://framework.zend.com/