Created
May 23, 2011 19:28
-
-
Save eminetto/987365 to your computer and use it in GitHub Desktop.
PostForm
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class PostForm extends Zend_Form | |
{ | |
public function __construct($options = null) { | |
parent::__construct($options); | |
$this->generate(); | |
} | |
private function generate() { | |
$this->setName('Post'); | |
$id = new Zend_Form_Element_Hidden('id'); | |
$titulo = new Zend_Form_Element_Text('title'); | |
$titulo->setLabel('Título')->setRequired(true)->addFilter('StripTags')->addValidator('NotEmpty'); | |
$texto = new Zend_Form_Element_Textarea('description'); | |
$texto->setAttrib('rows', '20'); | |
$texto->setAttrib('cols', '100'); | |
$texto->setLabel('Texto')->setRequired(true) ->addFilter('StripTags') ->addValidator('NotEmpty'); | |
$submit = new Zend_Form_Element_Submit('submit'); | |
$submit->setLabel('Adicionar'); | |
$this->addElements(array($id, $titulo, $texto, $submit)); | |
//action e method | |
$this->setAction(BASE_URL.'/admin/admin')->setMethod('post'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment