zen of coding

notEmpty validation rule

With the recent changeset (https://trac.cakephp.org/changeset/7399) a new, ‘notEmpty’, validation rule is now available. As you can guess, it checks to make sure that a field contains something other than a white space.

You will have to upgrade to the latest build, to ensure that this rule is available in your cake core.

Otherwise you can rely on this simple regex, to achieve the same thing:

‘rule’ => array(’custom’, ‘/\S+/’)

%d bloggers like this: