Re: [fw-general] Is there a way to suppress specific validator error messages?

2010-02-12 Thread Jurian Sluiman
On Friday 12 Feb 2010 18:37:59 Ryan Lange wrote:
> My specific concern is with Zend_Validate_EmailAddress and host name
> validation. In the case of an input like "exam...@examplecom" (missing
> period in the host name), the validator returns 3 distinct error messages.
> Zend_Validate_EmailAddress sets its own message for host name validation
> failure, but it also pulls in all error messages (in this case, 2) from the
> Zend_Validate_Hostname instance it uses.
> 
> Now, showing the user 3 error messages that say essentially the same thing
> ("Your email address appears to be invalid") seems a bit much.
> 
> Keep in mind that this is not a question about *customizing* validator
> messages. I use Zend_Translate for that purpose, but, in my case, I'm still
> left with 3 identical error messages. I'm wondering if anyone knows of a
> way to simply "throw away" specific error messages. (On a whim, I tried
> setting the message templates to NULL, but that just ends up returning an
> empty string.)
> 
> Thanks in advance,
> Ryan

Looking at the code, there is no way to configure it.

I'd create my own EmailAddress validator, overriding the isValid() method to 
disable the error messages from the hostname validator.

Regards, Jurian
-- 
Jurian Sluiman
CTO Soflomo V.O.F.
http://soflomo.com


[fw-general] Is there a way to suppress specific validator error messages?

2010-02-12 Thread Ryan Lange
My specific concern is with Zend_Validate_EmailAddress and host name
validation. In the case of an input like "exam...@examplecom" (missing
period in the host name), the validator returns 3 distinct error messages.
Zend_Validate_EmailAddress sets its own message for host name validation
failure, but it also pulls in all error messages (in this case, 2) from the
Zend_Validate_Hostname instance it uses.

Now, showing the user 3 error messages that say essentially the same thing
("Your email address appears to be invalid") seems a bit much.

Keep in mind that this is not a question about *customizing* validator
messages. I use Zend_Translate for that purpose, but, in my case, I'm still
left with 3 identical error messages. I'm wondering if anyone knows of a way
to simply "throw away" specific error messages. (On a whim, I tried setting
the message templates to NULL, but that just ends up returning an empty
string.)

Thanks in advance,
Ryan