[Zend Framework] Zend_Form: Zend_Form を使わない form
別件調査の副産物。
 
 [markdown]
Zend_Formを使った方がメリットがありそう。
“`php:application/views/scripts/index/about.phtml
“`
“`php:application/controllers/IndexController.php
 public function aboutAction()
 {
 // action body
 $errors = ”;
 if ($this->getRequest()->isPost()) {
 $text = $this->getRequest()->getParam(‘text’);
 $date = $this->getRequest()->getParam(‘date’);
 $text = Zend_Filter::filterStatic($text, ‘StringToLower’);
 if (! Zend_Validate::is($text, ‘NotEmpty’)) {
 $errors .= ”
“;
 }
 if (! Zend_Validate::is($date, ‘Date’)) {
 $errors .= ”
“;
 }
 }
 if ($errors == ”) {
 $data = array(
 ‘text’ => $text,
 ‘date’ => $date
 );
 Zend_Debug::dump($data);
 }
 $this->view->assign(‘errors’, $errors);
 }
 “`
[/markdown]

