Hello everybody. I have a form and I want to set my custom errors in it. I am using Zend, and I have the following code...
//Create validators
$formMustBeEmail = new Zend_Validate_EmailAddress();
$formMustBeEmail->setMessage(array(
Zend_Validate_EmailAddress::INVALID => "1. Invalid type given, value should be a string",
Zend_Validate_EmailAddress::INVALID_FORMAT => "2. '%value%' is no valid email address in the basic format local-part@hostname",
Zend_Validate_EmailAddress::INVALID_HOSTNAME => "3. '%hostname%' is no valid hostname for email address '%value%'",
Zend_Validate_EmailAddress::INVALID_MX_RECORD => "4. '%hostname%' does not appear to have a valid MX record for the email address '%value%'",
Zend_Validate_EmailAddress::INVALID_SEGMENT => "5. '%hostname%' is not in a routable network segment. The email address '%value%' should not be resolved from public network.",
Zend_Validate_EmailAddress::DOT_ATOM => "6. '%localPart%' can not be matched against dot-atom format",
Zend_Validate_EmailAddress::QUOTED_STRING => "7. '%localPart%' can not be matched against quoted-string format",
Zend_Validate_EmailAddress::INVALID_LOCAL_PART => "8. '%localPart%' is no valid local part for email address '%value%'",
Zend_Validate_EmailAddress::LENGTH_EXCEEDED => "9. '%value%' exceeds the allowed length",
Then I make the form...
$this->addElement('text', 'email');
$emailElement = $this->getElement('email');
$emailElement
->setLabel('Emailadres')
->setOrder(1)
->setRequired(true)
->addValidator($formMustBeTest)
->addValidator($formMustBeEmail)
->addFilter(new Zend_Filter_StripTags());
But it doesn't work. I still get the normal errors made by Zend. Can anyone see what I am doing wrong?
Tnx in advanced...