A ver esta es una versión mejorada,
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');
foreach($ns->errors as $field => $errors) {
$form->getElement($field)->addErrors($errors);
}
}
$this->view->form = $form;
}
public function processAction()
{
if (!$this->_request->isPost()) {
$this->_helper->redirector->gotoSimple('index');
}
$form = new Application_Form_Guestbook();
if (!$form->isValid( $this->_request->getPost())) {
$ns = new Zend_Session_Namespace('formErrors');
$ns->setExpirationHops(1);
$ns->errors = $form->getMessages();
$this->_helper->redirector->gotoSimple('sign');
}
//do something
...
$this->_helper->redirector->gotoSimple('result');
}
Saludos.