本文整理匯總了PHP中Zend_Form_Element_Password::addErrorMessages方法的典型用法代碼示例。如果您正苦於以下問題:PHP Zend_Form_Element_Password::addErrorMessages方法的具體用法?PHP Zend_Form_Element_Password::addErrorMessages怎麽用?PHP Zend_Form_Element_Password::addErrorMessages使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Zend_Form_Element_Password
的用法示例。
在下文中一共展示了Zend_Form_Element_Password::addErrorMessages方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: init
public function init()
{
// autenticacao_email
$autenticacao_email = new Zend_Form_Element_Text('autenticacao_email');
$autenticacao_email->setLabel("E-mail: ");
$autenticacao_email->setRequired();
$autenticacao_email->setAttribs(array('class' => 'form-control', 'placeholder' => 'Informe seu e-mail'));
$autenticacao_email->addValidator("EmailAddress");
$autenticacao_email->addErrorMessages(array(Zend_Validate_EmailAddress::INVALID => "E-mail inválido!"));
// autenticacao_senha
$autenticacao_senha = new Zend_Form_Element_Password('autenticacao_senha');
$autenticacao_senha->setLabel("Senha: ");
$autenticacao_senha->setRequired();
$autenticacao_senha->addErrorMessages(array(Zend_Validate_NotEmpty::IS_EMPTY => "Campo obrigatório!"));
$autenticacao_senha->setAttribs(array('class' => 'form-control', 'placeholder' => 'Informe sua senha'));
$this->addElements(array($autenticacao_email, $autenticacao_senha));
parent::init();
}
示例2: getLoginForm
/**
* Assembles and returns a login form.
*
* @return unknown
*/
protected function getLoginForm()
{
$form = new Zend_Form();
// Add hash element to detect counterfeit formular data via validation.
$hash = new Zend_Form_Element_Hash('hash');
// Login name element.
$login = new Zend_Form_Element_Text('login');
$login->addValidator(new Zend_Validate_Regex('/^[A-Za-z0-9@._-]+$/'))->setRequired()->setLabel('auth_field_login');
$login->addErrorMessages(array(Zend_Validate_NotEmpty::IS_EMPTY => 'auth_error_no_username'));
// Password element.
$password = new Zend_Form_Element_Password('password');
$password->setRequired()->setLabel('auth_field_password');
$password->addErrorMessages(array(Zend_Validate_NotEmpty::IS_EMPTY => 'auth_error_no_password'));
// Submit button.
$submit = new Zend_Form_Element_Submit('SubmitCredentials');
$submit->setLabel('Login');
$form->setMethod('POST');
$form->addElements(array($hash, $login, $password, $submit));
return $form;
}