Tuesday, April 28, 2009

Validate in Controller

Trying to validate in controller before saving with this:

$this->User->$model_name->set($this->data);
debug($this->data);
if ($this->User->$model_name->validates()) {
debug($model_name);
$test = 'Validated';
debug($test);
} else {
$test = 'Not Validated';
debug($test);
}

debug data:
Array
(
[System] => Array
(
[System] => Array
(
[0] => abc <- manually entered with FireBug
[1] => 1
)

)

)


but it always comes back valid. Testing using one model where $model_name is
System and that model has validate 'system_id' => array('numeric')

Where am I going wrong?

Thanks,

Dave


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: