这是我的表单代码
$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/