var $validate = array( 'username' => array( 'Username must contain only letters and numbers' => array( 'rule' => '/^[a-z0-9]{3,}$/i', 'required' => true ), 'This username is already taken' => array( 'rule' => 'isUnique' ), 'Username must be at least 5 characters' => array( 'rule' => array('minlength', 5), ) ) );
Wednesday, August 3, 2011
More Validation Tips and Tricks
A good shortcut when creating Validation rules is to use the desired message as the key name. CakePHP will automatically use the key name as the error message in the absence of an explicit message.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment