Created
December 12, 2011 20:03
-
-
Save eminetto/1468851 to your computer and use it in GitHub Desktop.
AlbumForm
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 Application_Form_Album extends Zend_Form | |
{ | |
public function init() | |
{ | |
$this->setName('Foto'); | |
$title = new Zend_Form_Element_Text('title'); | |
$title->setLabel('Título')->setRequired(true)->addFilter('StripTags')->addValidator('NotEmpty'); | |
$file = new Zend_Form_Element_File('arq'); | |
$file->setLabel('Escolha uma imagem:'); | |
// limite de tamanho | |
$file->addValidator('Size', false, 1024000); | |
// extensões: JPEG, PNG, GIFs | |
$file->addValidator('Extension', false, 'jpg,png,gif'); | |
$submit = new Zend_Form_Element_Submit('submit'); | |
$submit->setLabel('Enviar'); | |
$submit->setName('submit'); | |
//exemplo de class css | |
$this->addElements(array($title, $file, $submit)); | |
//action e method | |
$this->setAction('/album')->setMethod('post'); | |
$this->setAttrib('enctype', 'multipart/form-data'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment