Ves, con codigo la gente se entiende mejor
, deberia ser algo asi:
Bootstrap.php
Código PHP:
Ver originalpublic function _initSession()
{
Zend_Session::start();
}
por recomendacón de Zend, cuando manipulas sesiones, el start debe ir en el bootstrap(para evitar errores)
TuController.php
Código PHP:
Ver originalpublic function signAction()
{
$form = new Application_Form_Guestbook();
$form->setAction(Zend_Controller_Front::getInstance()->getBaseUrl() . '/guestbook/process');
if(Zend_Session::namespaceIsset('formErrors')) {
$ns = new Zend_Session_Namespace('formErrors');
$form->isValid($ns->data);
}
$this->view->form = $form;
}
public function processAction()
{
if (!$this->_request->isPost()) {
$this->_helper->redirector->gotoSimple('index');
}
$form = new Application_Form_Guestbook();
$post = $this->_request->getPost();
if (!$form->isValid($post)) {
$ns = new Zend_Session_Namespace('formErrors');
$ns->setExpirationHops(1);
$ns->data = $post;
$this->_helper->redirector->gotoSimple('sign');
}
//do something
...
$this->_helper->redirector->gotoSimple('result');
}
que diferencia tenes a hacer algo como esto ?
Código PHP:
Ver originalpublic function signAction()
{
$form = new Application_Form_Guestbook();
if($this->_request->isPost() &&
$form->isValid($this->_request->getPost())){
//do something
...
$this->_helper->redirector->gotoSimple('result');
}
$this->view->form = $form;
}