Hi Stu,
After your light, I guess to figure out the issue:
Here's the code within the model (I just named Ab)
field1 is author_id and field2 is book_id
var $name = 'Ab';
var $validate = array(
'author_id' => array(
'rule' => array('uniqueValidation', 'Ab', 'author_id',
'book_id'),
'message' => 'The author and book is already taken, please
choose another.'
),
);
function uniqueValidation($data, $model, $field1, $field2){
if($this->find('list', array('conditions'=>array($field1=>$this-
>data[$model][$field1], $field2=>$this->data[$model][$field2])))
==true) {
return false;
} else {
return true;
}
}
Many 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
-~----------~----~----~----~------~----~------~--~---