无法在 ZF2 视图中获取类型文本区域的文本区域



这是我的表单代码

  $this->add(array(
         'name' => 'abc',
         'type' => 'TextArea',
         'options' => array(
         'label' => _('Enter description'),
     ),
     'attributes' => array(
            'rows' => '1',
            'cols' =>'75',
        )
     ));
这是我的视图代码
<?php echo $this->formLabel($form->get('abc'))."<br>"; ?> 
<?php echo $this->formInput($form->get('abc'))."<br>"; ?>

这里的问题是,我没有得到一个TextArea,而是得到一个普通的文本框。当我使用代码

时,它正在工作
<?php echo $this->formRow($form->get('abc'))."<br>"; ?> 

当我尝试分别打印标签和输入时,它不使用其类型和属性。

在您的视图中使用zend视图助手formText来打印文本区域

echo $this->formText($form->get('abc'))

在你的表单类使用type => ZendFormElementText

http://framework.zend.com/manual/2.0/en/modules/zend.form.view.helpers.html

最新更新