Right now, the only way to use the new Validation class is to write
your rules like this:
var $validate = array('username' => array('rule' => 'alphaNumeric'));
You can specify other rules as follows:
'rule' => array('between', $min, $max)
'rule' => array('blank')
'rule' => array('cc', $type, $deep)
Where $type can be 'fast' (a basic check that covers all card types) or
'all' (check all cards) or an array of one or more of the following:
'amex', 'bankcard', 'diners', disc', 'electron', 'enroute', 'jcb',
'maestro', 'mc', 'solo', 'switch', 'visa' or 'voyager'.
'rule' => array('comparison', $operator, $compare)
$operator may be one of the following: 'isgreater', 'isless',
'greaterorequal', 'lessorequal', 'equalto', 'notequal', or, their
symbol equivalents: '>', '<', '>=', '<=', '==', '!='.
'rule' => array('custom', $regex)
Where $regex is a custom regular expression.
'rule' => array('date', $format)
Where $format is one of the following: 'dmy', 'mdy', 'ymd', 'dMy',
'Mdy', 'My', 'my'. $format can also be an array containing mulitple
values.
'rule' => array('decimal', $precision)
Checks that the input is a decimal number with $precision places after
the decimal point.
'rule' => array('email', $deep)
If $deep is true, the email address will be checked for a valid host
name.
'rule' => array('minLength', $min)
'rule' => array('maxLength', $max)
'rule' => array('numeric')
'rule' => array('postal')
'rule' => array('ssn')
'rule' => array('url')
Those are the rules in a nutshell, although more will be added shortly.
Most of them should be pretty self-explanatory.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---