本文整理汇总了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;
}