How to change the layout of a form with Zend_Form decorators?

After a while, I just gave up and used just the ViewRenderer decorator. Here is a good post explaining how to do that ( weierophinney.net/matthew/archives/215-R... ). The rest of that series is good as well if you really want to know how to use decorators With the ViewRenderer decorator, you're basically rendering your form against a template (not unlike MVC itself).

This way gives you the ultimate control over everything, but of course what you gain in flexibility, you lose in RAD, and you make up in complexity.

After a while, I just gave up and used just the ViewRenderer decorator. Here is a good post explaining how to do that (weierophinney.net/matthew/archives/215-R...). The rest of that series is good as well if you really want to know how to use decorators.

With the ViewRenderer decorator, you're basically rendering your form against a template (not unlike MVC itself). This way gives you the ultimate control over everything, but of course what you gain in flexibility, you lose in RAD, and you make up in complexity.

If you want to change the elements of your form you have to reset the Decorators of your Form and it's elements. Example of enclosing a field in a p-tag class Default_Form_Contact extends Zend_Form { public function init() { $name = new Zend_Form_Element_Text('name'); $name->setLabel('Name:') ->setDecorators( array( array('ViewHelper', array('helper' => 'formText')), 'Errors', array('Description', array('tag' => 'p', 'class' => 'description')), array('HtmlTag', array('tag' => 'p', 'id' => 'name-element')), array('Label', array('class' => 'label')), ) ); $this->addElement($name); } } Which decorators you really need you have to consider yourself. For the form decorators you can do in the init() $this->setDecorators(array(some decorators)).

– Andrew Oct 27 '09 at 2:39 You can subclass all Zend_Element classes and overload loadDefaultDecorators. – Peter Smit Oct 27 '09 at 5:45.

If you want to change the elements of your form you have to reset the Decorators of your Form and it's elements.

After a while, I just gave up and used just the ViewRenderer decorator. Here is a good post explaining how to do that (http://weierophinney.net/matthew/archives/215-Rendering-Zend_Form-decorators-individually.html). The rest of that series is good as well if you really want to know how to use decorators.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions