Zend Form display groups and decorators with example

3 Nov

Sorry this blog is deprecated.

“Read new and updated version of this post here”. http://zendgeek.blogspot.com/2009/07/zend-form-display-groups-decorators.html

In my previous posts I discussed creation of zend form and decorators. These features are very helpful and quite easy to use.

However to give better look and feel to your form you will need to study Zend From display groups.

Display groups are used to group form elements for display purposes, so they give new look and feel to your forms. The name

of the form elements remain the same however elements in the same group are render together.

The most common use case would be to use display groups to put your form element in different field sets. Consider the following layout of the form.

Zend Form with Display Groups

Zend Form with Display Groups

Sorry this blog is deprecated.

“Read new and updated version of this post here”. http://zendgeek.blogspot.com/2009/07/zend-form-display-groups-decorators.html

8 Responses to “Zend Form display groups and decorators with example”

  1. butters November 4, 2008 at 9:58 am #

    hey, thanks for that nice example…

  2. Ilyas Iqbal November 13, 2008 at 12:14 am #

    again, Superb piece of work!

  3. Markus November 14, 2008 at 2:36 pm #

    This is madness? Why not use css?

  4. Zeno January 7, 2009 at 12:43 am #

    How about a customisable view phtml for Zend_Form? Without setDecorator()

    http://www.yu.id.au/2008/12/customisable-zend-form/

  5. Faheem Abbas January 8, 2009 at 6:34 am #

    Customizable view phtml can be used, but I feel it is better to handle form in seperate place rather than mixing it with the html.
    You can achieve any functionality and can design your form whatever way you like in single place. This will help in modification and in maintenence.

  6. Erik Seifert May 28, 2009 at 3:37 pm #

    Easy way for global handling decorators

    class My_Form extends Zend_Form
    {
    public function addElement($element, $name = null, $options = null)
    {
    if ( is_string('element') )
    {
    $element = $this->createElement($element, $name, $options);
    $element->removeDecorator('DtDdWrapper');
    $element->removeDecorator('Label');
    $element->addDecorator('HtmlTag', array('tag' => 'div', 'class' => 'zend_form'));
    $element->addDecorator('Label', array('tag' => 'div', 'class' => 'zend_form'));

    }
    parent::addElement($element);
    }
    }

  7. dhayal May 31, 2009 at 8:23 pm #

    I dont know how to thank u…

Trackbacks/Pingbacks

  1. Zend_Form - Zend Framework Forum - January 22, 2009

    […] ye, everything is possible.. you can even group elements into divs and then float them around.. here is some good post about decorators and groups.. Decorators with Zend_Form Zend Form display groups and decorators with example Zend Framework […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: