我尝试在表单中添加addDisplayGroup
,但我收到以下错误:
"调用未定义的方法Application \ Form \ MyForm :: addDisplayGroup()"
这是我的表单代码:
namespace Application\Form;
use Zend\Form\Form;
class MyForm extends Form {
public function __construct()
{
parent::__construct('Myform-form');
$this->setAttribute('method', 'post');
$this->addElements();
$this->addInputFilter();
}
private function addElements() {
$this->add(array(
'type' => 'text',
'name' => 'first_name',
'attributes' => array(
'id' => 'first_name'
),
'options' => array(
'label' => 'First Name: ',
),
));
$this->add(array(
'type' => 'text',
'name' => 'last_name',
'attributes' => array(
'id' => 'last_name'
),
'options' => array(
'label' => 'Last Name: ',
),
));
$this->addDisplayGroup(array('first_name', 'last_name'), 'information');
}
}
答案 0 :(得分:0)