Ah, wrong decorators - fixed! Regards, Saša Stamenković
On Fri, Nov 6, 2009 at 9:20 AM, umpirsky <umpir...@gmail.com> wrote: > > Yes, or > > $this->addDisplayGroup( > array( > 'e1', > 'e2' > ), > 'name', > array( > 'displayGroupClass' => 'My_Form_DisplayGroup' > ) > > But I get: > > Warning: Exception caught by form: Method getType does not exist Stack > Trace: #0 [internal function]: Zend_Form_DisplayGroup->__call('getType', > Array) #1 /usr/local/share/pear/Zend/Form/Decorator/ViewHelper.php(92): > Lib_Form_DisplayGroup->getType() #2 > /usr/local/share/pear/Zend/Form/Decorator/ViewHelper.php(233): > Zend_Form_Decorator_ViewHelper->getHelper() #3 > /usr/local/share/pear/Zend/Form/DisplayGroup.php(874): > Zend_Form_Decorator_ViewHelper->render('') #4 > /usr/local/share/pear/Zend/Form/Decorator/FormElements.php(101): > Zend_Form_DisplayGroup->render() #5 > /usr/local/share/pear/Zend/Form.php(2626): > Zend_Form_Decorator_FormElements->render('') #6 > /usr/local/share/pear/Zend/Form.php(2641): Zend_Form->render() #7 > /usr/local/www/ > svn.loopia.se/controlweb/umpirsky.test.af.loopia.se/application/views/scripts/userinfo/index.phtml(18) > : > Zend_Form->__toString() #8 /usr/local/share/pear/Zend/View.php(108): > include('/usr/local/www/...') #9 > /usr/local/share/pear/Zend/View/Abstract.php(833): > Zend_View->_run('/usr/local/www/...') #1 in > /usr/local/share/pear/Zend/Form.php on line 2646 > > My class: > > class My_Form_DisplayGroup extends Zend_Form_DisplayGroup { > public function loadDefaultDecorators() { > if ($this->loadDefaultDecoratorsIsDisabled()) { > return; > } > > $this->setDecorators( > array( > 'ViewHelper', > array(array('td' => 'HtmlTag'), array('tag' > => 'td', 'style' => 'width: > 360px;')), > array('Label', array('tag' => 'td', > 'requiredSuffix' => ' *')), > array(array('tr' => 'HtmlTag'), array('tag' > => 'tr')), > array(array('tbody' => 'HtmlTag'), > array('tag' => 'tbody')), > array(array('table' => 'HtmlTag'), array('tag' > => 'table', 'class' => > 'tiny')), > array(array('separator' => 'HtmlTag'), > array('tag' => 'div', 'class' > => 'separator')) > ) > ); > } > > } > > Any idea? > > > > Tim Fletcher wrote: > > > > It took me long time to work out that in order to subclass > > Zend_Form_DisplayGroup, you must set the class appropriately. If you're > > creating your form by subclassing Zend_Form you should use : > > > > $this->setDefaultDisplayGroupClass('App_Form_DisplayGroup'); > > > > -- > View this message in context: > http://old.nabble.com/Zend-Form%3A-Trying-to-add-a-Label-Decorator-to-a-DisplayGroup-tp18097521p26228255.html > Sent from the Zend Framework mailing list archive at Nabble.com. > >