Hi,
I'm wondering if I'm doing something wrong here (have searched docs,
sources and archives and can't find an answer).
The 'required' rule seems to be broken as it still reports an error
even when the field is not empty. The rule I have is:
'email' => array('rule'=>'required')
I traced this to this part of the code in Model:invalidFields():
if (method_exists($this, $rule)) {
$ruleParams[] = array_diff_key($validator, $default);
$valid = call_user_func_array(array(&$this, $rule), $ruleParams);
} elseif (method_exists($Validation, $rule)) {
$valid = call_user_func_array(array(&$Validation, $rule),
$ruleParams);
} elseif (!is_array($validator['rule'])) {
$valid = preg_match($rule, $data[$fieldName]);
}
where it always lands on the preg_match(...) line in the last
condition, where it tries to preg_match() $rule which has a value of
'required', against the data field.
Anyway, I tried using a pattern instead of 'required' and it works,
like this:
'email' => array('rule'=>VALID_NOT_EMPTY)
... but I'm wondering if the 'required' rule is working in 1.2?
Cheers,
Farez
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---