You can create your own validation method and pass both values to it.

http://book.cakephp.org/view/150/Custom-Validation-Rules


2009/5/11 Alexandre Brasil <[email protected]>:
>
> Hi Folks,
>
> Does it possible validate 2 fields with 1 rule in CakePHP?
>
> For instance, I have field1 and filed2 that need to be validaded as
> “isUnique” on the model (because on the database table they are UNIQUE
> but not PRIMARY KEY).
>
> I tried some like code below, but no sucess :(
>
> var $validate = array(
> ‘field1′ => array(’numeric’),
> ‘field2′ => array(’numeric’),
> array(’field1′,’field2′) => array(
> ‘isUnique’ => array(
> ‘rule’ => ‘isUnique’,
> ‘message’ => ‘Field1 and Field2 has already been taken’)),
> );
>
> Thanks
> Alexandre
>
> >
>

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

Reply via email to