0
votes

I have class with my form in folder /application/forms/Auth.php it looks like

class Form_Auth extends Zend_Form
{
    public function __construct()
    {
        $this->setName();
        parent::__construct();

        $username = new Zend_Form_Element_Text('username');
        $password = new Zend_Form_Element_Password('password');
        $mail = new Zend_Form_Element_Text('mail');
        $submit = new Zend_Form_Element_Submit('submit');

        $this->addElements(array($username,$password,$mail,$submit));
    }
}

When i try create object

$this->view->form = new Form_Auth();

is see exeption

Application error

Exception information:

Message: Invalid name provided; must contain only valid variable characters and be non-empty

Stack trace:

D:\WWW\zends\application\Forms\Auth.php(8): Zend_Form->setName() d:\WWW\zends\application\controllers\RegistrationController.php(49): Form_Auth->__construct() D:\WebServer\ZendFramework\ZendFramework\library\Zend\Controller\Action.php(513): RegistrationController->indexAction() D:\WebServer\ZendFramework\ZendFramework\library\Zend\Controller\Dispatcher\Standard.php(289): Zend_Controller_Action->dispatch('indexAction') D:\WebServer\ZendFramework\ZendFramework\library\Zend\Controller\Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http)) D:\WebServer\ZendFramework\ZendFramework\library\Zend\Application\Bootstrap\Bootstrap.php(97): Zend_Controller_Front->dispatch() D:\WebServer\ZendFramework\ZendFramework\library\Zend\Application.php(366): Zend_Application_Bootstrap_Bootstrap->run() D:\WWW\zends\public\index.php(26): Zend_Application->run() {main} Request Parameters:

array ( 'controller' => 'registration', 'action' => 'index', 'module' => 'default', )

the version zf is 1.10.3

what i do wrong ?

1

1 Answers

0
votes

We also managed this->setName('most have some name')