I've worked this one out myself - and it was pretty obvious: use a
beforeValidate method. I've included one below in case anyone else
searches and needs the answer
/**
* Returns true if all is ok, false if something failed validation
*/
function beforeValidate() {
echo '';
// Sample code to invalidate one field and make validation fail
$this->invalidate('field_Name', 'messageKey'); // messageKey can
be the error message or the key to the error message in the messages
array (see 1.2 validation documentation)
return false;
}
On Mar 28, 9:18 pm, Tim W <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> Say I have a check box and a text field on a form. If the check box is
> checked the form has to have a number in it. If the check box isn't
> checked then it must be empty. Does anyone know how to do this
> validation in 1.2? I could write a custom validation method but I
> can't work out how to access multiple pieces of data from the method.
>
> Thanks
>
> Tim
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" 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
-~----------~----~----~----~------~----~------~--~---