If you are trying to match dynamic data, it wont work because Cakes
default validation is for static data. Heres a method I use to match
dynamic:
Place this in your appmodel.
/**
* Validates two inputs against each other
* @param array $data
* @param string $confirmField
* @return boolean
*/
function validateMatch($data, $confirmField) {
$data = array_values($data);
$var1 = $data[0];
$var2 = (isset($this->data[$this->name][$confirmField])) ?
$this-
>data[$this->name][$confirmField] : '';
return ($var1 === $var2);
}
And then the validation rule:
'rule' => array('validateMatch', 'NAMEOFCONFIRMFIELD'),
'message' => 'They do not match'
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---