O'Reilly logo

CakePHP 1.3 Application Development Cookbook by Mariano Iglesias

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating a custom validation rule

CakePHP provides a handful of validation rules out of the box, which together covers the need for most applications. The following table lists the built-in validation rules (found in CakePHP's Validation class.)

Rule

Purpose

_alphaNumeric

Checks that the value contains only integers or letters.

_between

Checks that the string length of the value is within the specified range.

_blank

Succeeds if the value is empty, or consists of only spaces (whitespaces, tabs, newlines, and so on).

_boolean

Checks if value can be interpreted as a Boolean.

_cc

Validates a credit card number.

_comparison

Compares the value to a given value, using the specified operator.

_custom

Validates the value using ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required