I have the following problem:
I need to validate data in a controller, which is passed by a form. The special thing: The fields from the form are not present in the database, BUT in the $validate-Array. - Which should afaik not be a problem.
Another thing is, that the Model has a hasMany-Relationship with parts of this form.
Text hasMany Proofs
This is the validation-array:
var $validate = array(
'freetext' => array(
'between' => array(
'rule' => array('between', 250, 1000),
'message' => '..',
),
),
);
Here is an example of the data passed to the controller
[Proof] => Array
(
[0] => Array
(
[freetext] => asd
)
[1] => Array
(
[freetext] => asd
)
[2] => Array
(
[freetext] => asd
)
)
I use the following code to validate:
$this->Texts->set($this->data);
if ($this->Texts->validates()) {
When I call it, it returns true, so the validation succeed. BUT freetext has a bit less than 250 chars.
But: The form shows the red asterisks, which symbolizes me, that the validation-array is succesfully parsed an applied to the form.
And also in the corresponding controller beforeValidate() { debug($this->data); }
shows me the correct data.
So WHY does data validation succeed, even when the policies are not me?
Thanks ahead!
~MxAgent