class Form_Accounts_Add extends Zend_Form {
    public function init($options=array()) {
        $first_name     = new Zend_Form_Element_Text('first_name');
        $last_name      = new Zend_Form_Element_Text('last_name');
        $email          = new Zend_Form_Element_Text('email');
        $password       = new Zend_Form_Element_Text('encrypted_password'); 
        $first_name->setRequired(false);
        $last_name->setRequired(false);
        $email->setRequired(true)->addFilter('StringToLower')->addValidator('NotEmpty', true)->addValidator('EmailAddress');
        $password->setRequired(true);
        $this->addElements(array($first_name, $last_name, $email, $password));
    }
}
If the email isn't valid, I get: emailAddressInvalidHostname for $form->getErrors('email');
I would like to customize that error, is it possible?
This is just an example. This might help you.....
$email = new Zend_Form_Element_Text('emailid');
$email->setLabel("Email-Adress :* ")
      ->setOptions(array('size' => 20))
      ->setRequired(true)
      ->addFilter('StripTags')
      ->addFilter('StringTrim')
      ->addValidator('EmailAddress')
      ->getValidator('EmailAddress')->setMessage("Please enter a valid e-mail address.");
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With