Hi,

I'm trying to achieve this:
default:
<tr><td>label</td><td>field</td><td>errors ul li if any else empty</td></tr>
submit:
<tr class="form-submit"><td colspan="3">field</td></tr>
textarea:
<tr><td colspan="3">label <div class="errors">errors ul li if any else empty</div><br />field</td></tr>

-- snip --
   $default_element_decorator = array(
     'ViewHelper',
     array(
       'decorator' => array(
         'td' => 'HtmlTag'
       ),
       'options' => array(
         'tag' => 'td'
       ),
     ),
     array(
       'Label', array(
         'tag' => 'td'
       ),
     ),
     array(
       'Errors', array(
         'td' => 'HtmlTag',
       ),
     ),
     array(
       'decorator' => array(
         'tr' => 'HtmlTag'
       ),
       'options' => array(
         'tag' => 'tr'
       ),
     ),
   );

$this->setElementDecorators($default_element_decorator);
  // ....

   if ($element instanceof Zend_Form_Element_Submit)
   {
     $submit_decorator = array(
       array('ViewHelper'),
       array('Description'),
       array('HtmlTag',
         array('class' => 'form-submit')
       )
     );

     $element->setDecorators($submit_decorator);

   }

-- snip --

Is there any good tutorials for decorators?

--
Pekka Järvinen

Reply via email to