I did some quick research and tests. It's not 100% but it gives you the
structure you want.

1. Problem is that you can't use openOnly on the Label. It 'll always close
the tag after the label. And that the label must have a tag. Why? Don't
know. But that's why I setted it between 'div'.

2. I used description for the name 'Adress' and label for 'street',
'number', ...

3. Look at the th tag. Does it need a colspan? Cause you're having three
columns? So I added it, but don't really not know if it's necessary...

        public $elementDecorators = array(
          'ViewHelper',
          'Errors',
          array(array('data' => 'HtmlTag'), array('tag' => 'td', 'closeOnly' =>
true)),
          array('Label', array('tag' => '<div>')),
          array(array('col' => 'HtmlTag'), array('tag' => 'td', 'openOnly' =>
true)),
          array(array('row' => 'HtmlTag'), array('tag' => 'tr', 'openOnly' =>
true)),
          array('Description', array('tag' => 'th', 'placement'=> 'prepend',
'colspan'=>3))
        );

        public $elementDecorators1 = array(
          'ViewHelper',
          'Errors',
          array(array('data' => 'HtmlTag'), array('tag' => 'td', 'closeOnly' =>
true)),
          array('Label', array('tag' => '<div>')),
          array(array('col' => 'HtmlTag'), array('tag' => 'td', 'openOnly' =>
true)),
        );
        public $elementDecorators2 = array(
          'ViewHelper',
          'Errors',
          array(array('data' => 'HtmlTag'), array('tag' => 'td', 'closeOnly' =>
true)),
          array('Label', array('tag' => '<div>')),
          array(array('col' => 'HtmlTag'), array('tag' => 'td', 'openOnly' =>
true)),
          array(array('row' => 'HtmlTag'), array('tag' => 
'tr','closeOnly'=>true))
        );

        $formElements = self::createElement('text', 'street') 
          ->setDecorators($this->elementDecorators) 
          ->setLabel("Street") 
          ->setDescription("Adress");
        self::addElement($formElements);
        $formElements = self::createElement('text', 'number') 
          ->setDecorators($this->elementDecorators1) 
          ->setLabel("Number");
        self::addElement($formElements);
        $formElements = self::createElement('text', 'aptnumber') 
          ->setDecorators($this->elementDecorators2) 
          ->setLabel("Apt number");
        self::addElement($formElements);

-----
visit my website at  http://www.phpscriptor.com/ http://www.phpscriptor.com/ 
-- 
View this message in context: 
http://www.nabble.com/Zend-Form%2C-Groups-and-decorators%2C-how-to---tp21397914p21402178.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to