Sure, just return the error message from the function:
function isValidGreeble($data) {
if (somethingWentWrong($data)) {
return 'Something went wrong!';
}
if (mt_rand(1,3) == 1) {
return 'It\'s not your lucky day';
}
// Success
return true;
}
hth
grigri
On Jul 22, 5:11 pm, Pr0 Lurk3r <[email protected]> wrote:
> I have currently have this problem of a validating a field where there
> is an "override" which will change the validation criteria. I've got a
> working solution so far, but the message remains the same, which sort
> of gives the wrong impression.
>
> This would be cool:
>
> function customValidationFunc( $data ) {
> if( [some critera] ) return true;
>
> // failed criteria, so issue warning
> if( !$this->data['Tbl']['override'] ) {
> $message = "Warning: Field failing";
> // [assign message somehow]
> return false;
> }
>
> // issued override
>
> // check some other criteria
> if( [some other criteria] ) return true;
>
> // still failing, this is an error now
> $message = "Error: Field still failing";
> // [assign message somehow]
> return false;
>
> }
>
> Is this possible?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---