I have little experience with Zend Framework, but I like to play with it until it does not work. But now I can not solve this problem.
I have a form:
<?php class Application_Form_Login extends Zend_Form { protected $notEmpty; public function init() { // Create NotEmpty validator $notEmpty = new Zend_Validate_NotEmpty(); // Configure validators for username element $notEmpty->setMessage('Gelieve dit veld in te vullen'); $this->setMethod('post'); // emailAddress $this->addElement('text', 'emailAddress', array( 'filters' => array('StringTrim', 'StringToLower'), 'required' => true, 'validators' => array( array('validator' => $notEmpty), ), 'label' => 'Emailadres:' )); // password $this->addElement('password', 'password', array( 'filters' => array('StringTrim'), 'required' => true, 'validators' => array( array('validator' => $notEmpty), ), 'label' => 'Wachtwoord:' )); // submit $this->addElement('submit', 'submit', array( 'ignore' => true, 'label' => 'Inloggen' )); } }
View:
<?= $this->form ?> <?= $this->postdata ?> > <?= $this->form ?> <?= $this->postdata ?>
And AccountController:
<?php class AccountController extends Zend_Controller_Action { public function init() { echo 'data:'.$this->getRequest()->getPost('emailAddress'); } public function indexAction() { $this->view->postdata = var_dump($this->getRequest()->getParams()); $form = new Application_Form_Login(); $request = $this->getRequest(); if ($request->isPost()){ ($ this-> getRequest () -> getParams ()); <?php class AccountController extends Zend_Controller_Action { public function init() { echo 'data:'.$this->getRequest()->getPost('emailAddress'); } public function indexAction() { $this->view->postdata = var_dump($this->getRequest()->getParams()); $form = new Application_Form_Login(); $request = $this->getRequest(); if ($request->isPost()){ request-> getPost ())) { <?php class AccountController extends Zend_Controller_Action { public function init() { echo 'data:'.$this->getRequest()->getPost('emailAddress'); } public function indexAction() { $this->view->postdata = var_dump($this->getRequest()->getParams()); $form = new Application_Form_Login(); $request = $this->getRequest(); if ($request->isPost()){ ($ form-> getValues ())) { <?php class AccountController extends Zend_Controller_Action { public function init() { echo 'data:'.$this->getRequest()->getPost('emailAddress'); } public function indexAction() { $this->view->postdata = var_dump($this->getRequest()->getParams()); $form = new Application_Form_Login(); $request = $this->getRequest(); if ($request->isPost()){
As you can see, I added a comment: // THIS POINT NEVER REACHED. This controller has more features, but they are not relevant to my problem.
Let us explain this a little more. Very strange behavior is that when I put the data in their field, $ this-> view-> postdata = var_dump ($ this-> getRequest () → getParams () does not return the POST data. But when I put a note in the field login forms, I see the POST data. Of course, it is empty. Like this:
array 'controller' => string 'account' (length=7) 'action' => string 'index' (length=5) 'module' => string 'default' (length=7) 'emailAddress' => string '' (length=0) 'password' => string '' (length=0) 'submit' => string 'Inloggen' (length=8) ' (length = array 'controller' => string 'account' (length=7) 'action' => string 'index' (length=5) 'module' => string 'default' (length=7) 'emailAddress' => string '' (length=0) 'password' => string '' (length=0) 'submit' => string 'Inloggen' (length=8) ' (length = array 'controller' => string 'account' (length=7) 'action' => string 'index' (length=5) 'module' => string 'default' (length=7) 'emailAddress' => string '' (length=0) 'password' => string '' (length=0) 'submit' => string 'Inloggen' (length=8) (length = array 'controller' => string 'account' (length=7) 'action' => string 'index' (length=5) 'module' => string 'default' (length=7) 'emailAddress' => string '' (length=0) 'password' => string '' (length=0) 'submit' => string 'Inloggen' (length=8)
Thus, // THIS POINT never reaches actually achieved at the data input field in the room shape :-)
The question is, what am I doing wrong? I incorrectly handles Zend_Controller_Request_Http?
If you need more information, I must give it.