This is the code I use in my own Form class that all my forms inherit from. The main trick is to only use the ViewHelper Decorator on the button itself, and stick the buttons in a displaygroup that uses a DtDdWrapper and wraps the buttons in a <div class='buttons'>
for extra styling options
protected $_buttons = array();
/**
* Sets a list of buttons - Buttons will be standard submits, or in the getJson() version
* they are removed from display - but stuck in the json in the .buttons property
*
* $buttons = array('save'=>'Save This Thing', 'cancel'=>'Cancel') as an example
*
* @param array $buttons
* @return void
* @author Corey Frang
*/
public function setButtons($buttons)
{
$this->_buttons = $buttons;
foreach ($buttons as $name => $label)
{
$this->addElement('submit', $name, array(
'label'=>$label,
'class'=>$name,
'decorators'=>array('ViewHelper'),
));
}
$this->addDisplayGroup(array_keys($this->_buttons),'buttons', array(
'decorators'=>array(
'FormElements',
array('HtmlTag', array('tag'=>'div', 'class'=>'buttons')),
'DtDdWrapper'
)
));
}
// Example from form::init()
$this->setButtons(array('save'=>'Save Entry', 'delete'=>'Delete Entry'));