Php – Validate field in model with no table (CakePHP)


I've got a model in CakePHP that doesn't have a table, called Upload. I've got a validation in this Model for a field called source_id.

I've got a form that builds a nice looking $this-data, giving me a well formated set, including:


However, the validation rule I have set doesn't seem to run at all. I copied this validation rule from another model where it does work, so I'm confident that it works:

var $validate = array(
        'source_id' => array(
        rule' => 'numeric',
        'required' => true,
        'allowEmpty' => false,
        'message' => 'Error!.'

Can you not validate fields for a model that lacks a database table?

The form uses the Upload model, and submits to another controller action method.

CakePHP 1.2, PHP/MySQL 5, XAMPP.

Best Solution

I'm dumb. You have to trigger a validation check, either with a save() or


Working now.

Related Question