开发者

Need help understanding Zend_Form decorator rendering

开发者 https://www.devze.com 2023-02-05 03:06 出处:网络
I have $title = new Zend_Form_Element_Text(\'title\', array(\'size\'=>\'20\')); $title->setLabel(\'Title\')

I have

$title = new Zend_Form_Element_Text('title', array('size'=>'20'));
$title->setLabel('Title')
               ->addValidator('NotEmpty')
                ->setDecoratorsarray(
        'ViewHelper',
        array(array('dataz'=>'HtmlTag'), array('tag' => 'div', 'class'  => 'input')),
         array('Label', array('tag' => 'td')),
         array('row'=>'HtmlTag', array('tag' => 'div','class'=>'element')),
    );

I need help understanding how to set parameters.

  • Why do we first point ViewHelper not the end?
  • Why 2 times html tag between the label?

If I change their position, it doesn't render correctly.

Why only in last option would you want to warp elements (label and input) in the div with class "element"? If I only define HtmlTag once it warps only input elements together, not 开发者_如何转开发 both label and input.

How do I wrap both elements?


$title = new Zend_Form_Element_Text('title', array('size'=>'20'));
$title->setLabel('Title')
               ->addValidator('NotEmpty')
                ->setDecorators(array(
        'ViewHelper',
        array(array('dataz'=>'HtmlTag'), array('tag' => 'div', 'class'  => 'input')),
         array('Label', array('tag' => 'td')),
         array('row'=>'HtmlTag', array('tag' => 'div','class'=>'element')),
    ));

Sorry it was some mistake in code.

0

精彩评论

暂无评论...
验证码 换一张
取 消