On 3 Apr 2008, at 15:55, Matthew Weier O'Phinney wrote:
-- dowker <[EMAIL PROTECTED]> wrote
(on Thursday, 03 April 2008, 07:39 AM -0700):
When trying to validate an email address, many different validation
messages
can appear depending on what the user enters. For example, if a
user enters
"[EMAIL PROTECTED]" (without the quotes), we get the following validation
messages:
* 'test.' is not a valid hostname for email address '[EMAIL PROTECTED]'
* 'test.' appears to be a DNS hostname but cannot extract TLD part
* 'test.' does not appear to be a valid local network name
* 'test.' appears to be a local network name but local network
names are
not allowed
While this amount of detail can be very useful in some cases, it
really
isn't when trying to display user-friendly messages in a form.
Is there a way to limit the messages to something simple like "The
email
address you entered is incorrect."?
Right now, no, not without a little work. Several people have
requested
such a feature now, and it is in the tracker.
For the time being, I'd suggest the following:
[snip]
In addition to Matthew's solution, I was much lazier and simply
extended Zend_Validate_EmailAddress and overrode the error text:
class App_Validate_EmailAddress extends Zend_Validate_EmailAddress
{
protected $_messageTemplates = array(
self::INVALID => "%value% is not a valid email
address",
self::INVALID_HOSTNAME => "%value% is not a valid email
address",
self::INVALID_MX_RECORD => "%value% is not a valid email
address",
self::DOT_ATOM => "%value% is not a valid email
address",
self::QUOTED_STRING => "%value% is not a valid email
address",
self::INVALID_LOCAL_PART => "%value% is not a valid email
address"
);
}
Again, you need to do set your element prefix path.
Regards,
Rob...