CakePHP field required validation rule

CakePHP field required validation rule - How to make a CakePHP view field a required field.

I'm still very new to CakePHP, and as a result I just spent thirty minutes fighting with a CakePHP field required rule. In short, if you want a text field to be required, your CakePHP validation rule should look something like this:

# cakephp validation rule to make a field required
var $validate = array(
  'description' => array(
      'rule' => 'notEmpty',
      'message' => 'Dude, Description is required'
   )
);

You don't have to have a message in your rule like that; the important thing is that your rule is set to 'notEmpty'. Don't try to make the rule 'required', and don't do what I was trying to do, which was to make it alphaNumeric and required, because alphaNumeric means what it says.

Just set your CakePHP field required validation rule to 'notEmpty', and you should be good to go.