Created
November 2, 2011 22:40
-
-
Save eminetto/1335173 to your computer and use it in GitHub Desktop.
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_LoginForm extends Zend_Form | |
{ | |
public function init() | |
{ | |
//nome do formulário | |
$this->setName('Login'); | |
//elemento para o campo username | |
$username = new Zend_Form_Element_Text('username'); | |
//configurar o label, dizer q é obrigatório, adicionar um filtro e um validador | |
$username->setLabel('Login') | |
->setRequired(true) | |
->addFilter('StripTags') | |
->addValidator('NotEmpty'); | |
//elemento para a senha | |
$password = new Zend_Form_Element_Password('password'); | |
$password->setLabel('Senha') | |
->setRequired(true) | |
->addFilter('StripTags') | |
->addValidator('NotEmpty'); | |
//botão de submit | |
$submit = new Zend_Form_Element_Submit('submit'); | |
$submit->setLabel('Entrar'); | |
$submit->setAttrib('id', 'Entrar'); | |
//exemplo de class css | |
//$submit->setAttrib('class', 'verde buttonBar'); | |
//adicionar os campos ao formulário | |
$this->addElements(array($username, $password, $submit)); | |
//action e method | |
$this->setAction('/index/index')->setMethod('post'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment