Home

Tue, Mar. 25th, 2008, 11:16 pm
CakePHP Validation

So from 1.1 to 1.2, validation changed too. Apparently 'alphaNumeric' validation is just that (26 letters, and 10 arabic numerals). The following worked for a required field, which could not be left blank, but would allow spaces and alphanums:
'fieldName' => array( 
	'rule' => array('custom', '/^[a-z0-9 ]*$/i'), 
	'required' => true, 
	'allowEmpty' => false )