-- buttie <[EMAIL PROTECTED]> wrote
(on Thursday, 21 August 2008, 02:16 AM -0700):
> I have created a form in the standard way using Zend_Form
> 
> $form->setMethod('post')
>                ->setAttrib('id', 'new_user')
>                ->setDecorators(array('FormElements','Form'))
> ........etc
> 
> To display this in the view it is as simple as 
> 
> $this->form
> 
> However I wish to just display aspects or elements of this form, is this
> possible? I am aware you can use display groups identified by id, so for
> example:
> 
> $this->form->my_display_group
> 
> but is it possible to just access say a drop down, text field etc?

Yes. You can access any attached element, display group, or sub form by
name as if it were a property of the form, just as you show above.
Within display groups and sub forms, you can do the same.

> My reasons for doing this is that the display of the form is quite
> complicated and varied, so extending the decorators etc would be really
> painful, as such I would just like to be able to draw my form in the view
> and grab the elements as needed. Obviously I could draw the form from
> scratch in the view but this seems like a real waste.

As noted above, this is already built in, and was one of the design
goals for the component.

-- 
Matthew Weier O'Phinney
Software Architect       | [EMAIL PROTECTED]
Zend Framework           | http://framework.zend.com/

Reply via email to