I am just starting to figure out Zend_Form_Decorators and have a question on
the best way to have Multiple buttons on one line all surround in one
<div></div>

Here is what I have and it works but I am wondering is this the best way to
do this?

I have three decorators

// adds the <div to the first button
public $openButtonDecorators = array(
        'ViewHelper',
        array('HtmlTag', array('tag' => 'div', 'class' => 'element',
'openOnly'=>true))
    );

// just outputs a button no decorator
    public $noButtonDecorators = array(
       'ViewHelper',
    );

//closes the div on the last button.
    public $closeButtonDecorators = array(
        'ViewHelper',
        array('HtmlTag', array('tag' => 'div', 'class' => 'element',
'closeOnly'=>true))
    );

Then I take the buttons and add the decorators to them.

        $form->addElement('submit', 'submit', array(
            'Name'=> 'Submit Button',
            'decorators' => $this->openButtonDecorators,
        ));
        $form->addElement('reset', 'cancel', array(
            'Name'=> 'Cancel Button',
            'decorators' => $this->noButtonDecorators,
        ));
        $form->addElement('submit', 'submit1', array(
            'Name'=> 'Submit One Button',
            'decorators' => $this->closeButtonDecorators,
        ));


Is this the best way to do this?

Shaun J. Farrell
Washington, DC
http://www.livinginthedistrict.com/
http://www.kapustabrothers.com/

Reply via email to