Guest User

Untitled

a guest
Jun 20th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. <?php
  2. $form = new Zend_Form('article');
  3. $form->setAction('/article/edit/idarticle/' . $article->idarticle )->addAttribs(array('name' => 'article'));
  4.  
  5. $form_elements = array(
  6. 'title' => new Zend_Form_Element_Text('title',array('label'=>'Tytuł','value' => $article->title)),
  7. // and other fields
  8. );
  9.  
  10. // add validation
  11. $form_elements['title']->addValidator('NotEmpty', false, array('messages' => array('isEmpty' => "can't be empty!")));
  12.  
  13.  
  14. $form->addElements($form_elements);
  15.  
  16.  
  17. // form was submitted
  18. if ($this->_request->isPost()) {
  19. echo 'submit.<br>';
  20. $formData = $this->_request->getPost();
  21. $form->getErrors();
  22. // validation
  23. if($form->isValid($formData))
  24. $form->getMessages();
  25. }
  26. ?>
Add Comment
Please, Sign In to add comment