when i try to validate a form's field that doesn't exist in the
database i get this error.
the validation works for fields that are in the database.
var $validate = array(
'imagedata' => array('No image uploaded.' => VALID_NOT_EMPTY),
);
that's the validation line. 'imagedata' is only in the form, and moved
later to the database.
then again, models should work with databases.. so is it the
controller's job to check it out?
Warning (2): preg_match() expects parameter 2 to be string, array
given [CORE\cake\libs\model\model.php, line 1744]
$this = Image object
$data = array("media_category_id" => "", "filename" => "", "name" =>
"", "description" => "", "imagedata" => array, "cuser" => 1)
$Validation = Validation object
$ruleSet = array("No image uploaded." => "/.+/")
$fieldName = "imagedata"
$validator = array("allowEmpty" => null, "required" => null, "rule"
=>
"/.+/", "last" => false, "on" => null)
$index = "No image uploaded."
$default = array("allowEmpty" => null, "required" => null, "rule"
=>
"blank", "last" => false, "on" => null)
$message = "This field cannot be left blank"
$rule = "/.+/"
$ruleParams = array(0 => array)
$valid = true
$msg = null
} 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]);
}
preg_match - [internal], line ??
Model::invalidFields() - CORE\cake\libs\model\model.php, line 1744
Model::validates() - CORE\cake\libs\model\model.php, line 1660
ImagesController::admin_add() - CORE\app\controllers
\images_controller.php, line 46
Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 341
Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 323
[main] - CORE\app\webroot\index.php, line 83
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---