On Jul 11, 2008, at 6:47 PM, David Zülke wrote:

> 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?

Well, currently it is that the generic error message serves as  
'something went wrong but no specific error message was provided' -  
some validators take a ton of potential errors. And there is  
currently no way of giving a default error message and giving a more  
specific to 'required'. Like 'wrong file format' for all errors, but  
'you need to specify a file' for required. That's a bit annoying.

>
>
> David
>

felix

>
>
>
> 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


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

Reply via email to