A good way is to create a model that has a method that does the validation.
In the controller you could handle the request this way:
public function saveAction()
{
if (!$this->getRequest()->isPost()) {
return $this->_helper->redirector('index');
}
if (false === ($model()->saveForm($this->getForm(),
$this->getRequest()->getPost()))) {
return $this->render('edit');
}
$this->_helper->FlashMessenger($this->view->translate('Saved model
successfully!'));
$this->_helper->redirector('index');
}
In the model f.e.:
public function saveForm(Zend_Form $form, array $post)
{
if (!$form->isValid($post)) {
return false;
}
$values = $form->getValues();
// ... save data to database
return true;
}
--
View this message in context:
http://zend-framework-community.634137.n4.nabble.com/Usage-of-Zend-Validate-with-Zend-Form-tp2301512p2301943.html
Sent from the Zend Framework mailing list archive at Nabble.com.