The general idea is that validators have specific error message code  
for actual problems encountered during validation. Examples are "min"  
and "max" in the string validator. The generic <error> then serves as  
the "you need to enter this" message.

Or did I understand something wrong?


David




Am 11.07.2008 um 18:00 schrieb Felix Gilcher:

> Hi,
>
> the check for a required parameter currently throws the general error
> message in any case, there is no way to distinguish a 'you need to
> specify this parameter' from the 'oops, something wrong with that
> parameter'. The relevant code snippet is in AgaviValidator.class.php
>
>                               if($this->getParameter('required', true)) {
>                                       $this->throwError();
>                                       $result = $errorCode;
>                               } else {
>                                       // we don't throw an error here because 
> this is not an incident
> per se
>                                       // but rather a non validated field
>                                       $result = self::NOT_PROCESSED;
>                               }
>
> I think this should specify something like
>
>                               if($this->getParameter('required', true)) {
>                                       $this->throwError('required');
>                                       $result = $errorCode;
>                               } else {
>                                       // we don't throw an error here because 
> this is not an incident
> per se
>                                       // but rather a non validated field
>                                       $result = self::NOT_PROCESSED;
>                               }
>
> so that users can set a specific error message. That's a minor change
> and keeps BC, so I hope to see that. Any thoughts on that? Should I
> open a ticket?
>
> cheers.
>
> felix
>
>
> _______________________________________________
> Agavi Dev Mailing List
> [email protected]
> http://lists.agavi.org/mailman/listinfo/dev
>


_______________________________________________
Agavi Dev Mailing List
[email protected]
http://lists.agavi.org/mailman/listinfo/dev

Reply via email to