Zend framework Zend Framework多表单元素名称

Zend framework Zend Framework多表单元素名称,zend-framework,zend-form,Zend Framework,Zend Form,我的应用程序中有多个Zend Frameworkv1.12表单 主要形式: <?php class Application_Form_Main extends Zend_Form { public function init() { $this->setMethod('post')->setAction('some/url'); } } ?> 我的子窗体: <?php class Application_Form_U

我的应用程序中有多个Zend Frameworkv1.12表单

主要形式:

<?php

class Application_Form_Main extends Zend_Form
{

    public function init()
    {
        $this->setMethod('post')->setAction('some/url');
    }
}

?>
我的子窗体:

<?php

class Application_Form_User extends Zend_Form_SubForm
{

    public function init()
    {

       //first name element
        $this->addElement('text', 
                          'first_name', 
                          array(
                            'label'      => 'Name',
                            'required'   => true,  
                            'filters'    => array('StringTrim')           
                          )
        );

        //last name element
        $this->addElement('text', 
                          'last_name', 
                          array(
                            'label'      => 'Surname',
                            'required'   => true,
                            'filters'    => array('StringTrim')           
                          )
        );

        $this->setElementDecorators(array(
            'ViewHelper',
            'Errors'
        )); 
    }    

}

?>
在我的自定义控制器中,例如UsersController.php Im呈现主窗体和多个用户子窗体:

<?php 

$mainForm = new Application_Form_Main();

for($i=0; $i<2; $i++){

    $userForm = new Application_Form_User();              

    $mainForm->addSubForm($userForm, 'user_'.($i+1)); 

}       

//passing main form to the template
$this->view->mainForm = $mainForm;

?>
所以我得到的表单有两个用户的名字和姓氏字段

在“我的模板”Im呈现表单中,使用以下方式:

<form action="<?php echo $this->mainForm->getAction(); ?>"
      enctype="<?php echo $this->form->getEnctype(); ?>"
      method="<?php echo $this->form->getMethod(); ?>"
">

<?php echo $this->mainForm->getSubForm('user_1')->first_name; ?>
<?php echo $this->mainForm->getSubForm('user_1')->last_name; ?>

<?php echo $this->echo $this->mainForm->getSubForm('user_2')->first_name; ?>
<?php echo $this->echo $this->mainForm->getSubForm('user_2')->last_name; ?>

</form>
问题是名字和姓氏文本字段名称在两种形式中是相同的。如何使其具有唯一的名称?如果我输出表单:

<?php echo $this->mainForm; ?>
然后一切正常,我得到不同的字段名

有什么想法吗