css - 无法在 ZF2 View 中获取 TextArea 类型的 TextArea

标签 css zend-framework2 zend-form

这是我的表单代码

  $this->add(array(
         'name' => 'abc',
         'type' => 'TextArea',
         'options' => array(
         'label' => _('Enter description'),
     ),
     'attributes' => array(
            'rows' => '1',
            'cols' =>'75',
        )

     ));

这是我的 View 代码

<?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>"; ?> 

当我尝试分别打印标签和输入时,它没有使用它的类型和属性。我该如何纠正我的情况。

最佳答案

在你的 View 中使用 zend view helper formText 来打印文本区域

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

在你的表单类中使用 type => Zend\Form\Element\Text

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

关于css - 无法在 ZF2 View 中获取 TextArea 类型的 TextArea,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24819254/

相关文章:

php - Zend 框架中的 URL 验证 1

zend-framework - 如何自定义Zend_Validate_File_Upload::INI_SIZE错误消息?

zend-framework2 - Zend Framework 2 - 输出表单元素,对象作为 HTML 字段

html - DIV 未正确拉伸(stretch)?

javascript - 根据点击过滤 SharePoint(表) View - Jquery

css - 如果我在使用视口(viewport)单元时更改浏览器缩放比例,有没有办法调整文本大小

php - Ajax 和下载 CSV 文件

php - Zend framework 2 推荐的错误处理方式

php - 使用 Zend Framework 2 中的 FormElement ViewHelper 呈现自定义表单元素

javascript - 无法固定 div 中空值的位置