- 2008-04-06 (Sun) 7:00
- Zend_Validate
- Zend_Validate_Alnum
- Zend_Validate_Alpha
- Zend_Validate_Barcode
- Zend_Validate_Between
- Zend_Validate_Ccnum
- Zend_Validate_Date
- Zend_Validate_EmailAddress
- Zend_Validate_Float
- Zend_Validate_GreaterThan
- Zend_Validate_Hex
- Zend_Validate_Hostname
- Zend_Validate_Identical
- Zend_Validate_InArray
- Zend_Validate_Int
- Zend_Validate_Ip
- Zend_Validate_LessThan
- Zend_Validate_NotEmpty
- Zend_Validate_Regex
- Zend_Validate_StringLength
- An example of message file(TXT Format)
Following is about the constructer.
/** * Sets default option values for this instance * * @param boolean $allowWhiteSpace * @return void */ public function __construct($allowWhiteSpace = false)
Following is about the error messages.
| Error Message Key | Initial Error Message |
|---|---|
| notAlnum | '%value%' has not only alphabetic and digit characters |
| stringEmpty | '%value%' is an empty string |
Following is about the constructer.
/** * Sets default option values for this instance * * @param boolean $allowWhiteSpace * @return void */ public function __construct($allowWhiteSpace = false)
Following is about the error messages.
| Error Message Key | Initial Error Message |
|---|---|
| notAlpha | '%value%' has not only alphabetic characters |
| stringEmpty | '%value%' is an empty string |
Following is about the constructer.
('upc' or 'ean13' can be used as the parameter $barcodeType)
/** * Generates the standard validator object * * @param string $barcodeType - Barcode validator to use * @return void * @throws Zend_Validate_Exception */ public function __construct($barcodeType)
Following is about the error messages(UPC-A).
| Error Message Key | Initial Error Message |
|---|---|
| invalid | '%value%' is an invalid UPC-A barcode |
| invalidLength | '%value%' is an invalid UPC-A barcode |
Following is about the error messages(EAN-13).
| Error Message Key | Initial Error Message |
|---|---|
| invalid | '%value%' is an invalid EAN-13 barcode |
| invalidLength | '%value%' should be 13 characters |
Following is about the constructer.
/** * Sets validator options * * @param mixed $min * @param mixed $max * @param boolean $inclusive * @return void */ public function __construct($min, $max, $inclusive = true)
Following is about the error messages.
| Error Message Key | Initial Error Message |
|---|---|
| notBetween | '%value%' is not between '%min%' and '%max%', inclusively |
| notBetweenStrict | '%value%' is not strictly between '%min%' and '%max%' |
This class has no constructer.
Following is about the error messages.
| Error Message Key | Initial Error Message |
|---|---|
| ccnumLength | '%value%' must contain between 13 and 19 digits |
| ccnumChecksum | Luhn algorithm (mod-10 checksum) failed on '%value%' |
Following is about the constructer.
/** * Sets validator options * * @param string $format OPTIONAL * @param string|Zend_Locale $locale OPTIONAL * @return void */ public function __construct($format = null, $locale = null)
Following is about the error messages.
| Error Message Key | Initial Error Message |
|---|---|
| dateNotYYYY-MM-DD | '%value%' is not of the format YYYY-MM-DD |
| dateInvalid | '%value%' does not appear to be a valid date |
| dateFalseFormat | '%value%' does not fit given date format |
This class has no constructer.
Following is about the error messages.
| Error Message Key | Initial Error Message |
|---|---|
| notDigits | '%value%' contains not only digit characters |
| stringEmpty | '%value%' is an empty string |
Following is about the constructer.
/** * Instantiates hostname validator for local use * * You can pass a bitfield to determine what types of hostnames are allowed. * These bitfields are defined by the ALLOW_* constants in Zend_Validate_Hostname * The default is to allow DNS hostnames only * * @param integer $allow OPTIONAL * @param bool $validateMx OPTIONAL * @param Zend_Validate_Hostname $hostnameValidator OPTIONAL * @return void */ public function __construct($allow = Zend_Validate_Hostname::ALLOW_DNS, $validateMx = false, Zend_Validate_Hostname $hostnameValidator = null)
Following is about the error messages.
| Error Message Key | Initial Error Message |
|---|---|
| emailAddressInvalid | '%value%' is not a valid email address in the basic format local-part@hostname |
| emailAddressInvalidHostname | '%hostname%' is not a valid hostname for email address '%value%' |
| emailAddressInvalidMxRecord | '%hostname%' does not appear to have a valid MX record for the email address '%value%' |
| emailAddressDotAtom | '%localPart%' not matched against dot-atom format |
| emailAddressQuotedString | '%localPart%' not matched against quoted-string format |
| emailAddressInvalidLocalPart | '%localPart%' is not a valid local part for email address '%value%' |
This class has no constructer.
Following is about the error messages.
| Error Message Key | Initial Error Message |
|---|---|
| notFloat | '%value%' does not appear to be a float |
Following is about the constructer.
/** * Sets validator options * * @param mixed $min * @return void */ public function __construct($min)
Following is about the error messages.
| Error Message Key | Initial Error Message |
|---|---|
| notGreaterThan | '%value%' is not greater than '%min%' |
This class has no constructer.
Following is about the error messages.
| Error Message Key | Initial Error Message |
|---|---|
| notHex | '%value%' has not only hexadecimal digit characters |
Following is about the constructer.
/** * Sets validator options * * @param integer $allow OPTIONAL Set what types of hostname to allow (default ALLOW_DNS) * @param boolean $validateIdn OPTIONAL Set whether IDN domains are validated (default true) * @param boolean $validateTld OPTIONAL Set whether the TLD element of a hostname is validated (default true) * @param Zend_Validate_Ip $ipValidator OPTIONAL * @return void * @see http://www.iana.org/cctld/specifications-policies-cctlds-01apr02.htm Technical Specifications for ccTLDs */ public function __construct($allow = self::ALLOW_DNS, $validateIdn = true, $validateTld = true, Zend_Validate_Ip $ipValidator = null)
Following is about the error messages.
| Error Message Key | Initial Error Message |
|---|---|
| hostnameIpAddressNotAllowed | '%value%' appears to be an IP address, but IP addresses are not allowed |
| hostnameUnknownTld | '%value%' appears to be a DNS hostname but cannot match TLD against known list |
| hostnameDashCharacter | '%value%' appears to be a DNS hostname but contains a dash (-) in an invalid position |
| hostnameInvalidHostnameSchema | '%value%' appears to be a DNS hostname but cannot match against hostname schema for TLD '%tld%' |
| hostnameUndecipherableTld | '%value%' appears to be a DNS hostname but cannot extract TLD part |
| hostnameInvalidHostname | '%value%' does not match the expected structure for a DNS hostname |
| hostnameInvalidLocalName | '%value%' does not appear to be a valid local network name |
| hostnameLocalNameNotAllowed | '%value%' appears to be a local network name but local network names are not allowed |
Following is about the constructer.
/** * Sets validator options * * @param string $token * @return void */ public function __construct($token = null)
Following is about the error messages.
| Error Message Key | Initial Error Message |
|---|---|
| notSame | Tokens do not match |
| missingToken | No token was provided to match against |
Following is about the constructer.
/** * Sets validator options * * @param array $haystack * @param boolean $strict * @return void */ public function __construct(array $haystack, $strict = false)
Following is about the error messages.
| Error Message Key | Initial Error Message |
|---|---|
| notInArray | '%value%' was not found in the haystack |
This class has no constructer.
Following is about the error messages.
| Error Message Key | Initial Error Message |
|---|---|
| notInt | '%value%' does not appear to be an integer |
This class has no constructer.
Following is about the error messages.
| Error Message Key | Initial Error Message |
|---|---|
| notIpAddress | '%value%' does not appear to be a valid IP address |
Following is about the constructer.
/** * Sets validator options * * @param mixed $max * @return void */ public function __construct($max)
Following is about the error messages.
| Error Message Key | Initial Error Message |
|---|---|
| notLessThan | '%value%' is not less than '%max%' |
This class has no constructer.
Following is about the error messages.
| Error Message Key | Initial Error Message |
|---|---|
| isEmpty | Value is empty, but a non-empty value is required |
Following is about the constructer.
/** * Sets validator options * * @param string $pattern * @return void */ public function __construct($pattern)
Following is about the error messages.
| Error Message Key | Initial Error Message |
|---|---|
| regexNotMatch | '%value%' does not match against pattern '%pattern%' |
Following is about the constructer.
/** * Sets validator options * * @param integer $min * @param integer $max * @return void */ public function __construct($min = 0, $max = null)
Following is about the error messages.
| Error Message Key | Initial Error Message |
|---|---|
| stringLengthTooShort | '%value%' is less than %min% characters long |
| stringLengthTooLong | '%value%' is greater than %max% characters long |
notAlnum;'%value%' has not only alphabetic and digit characters
stringEmpty;'%value%' is an empty string
notAlpha;'%value%' has not only alphabetic characters
invalid;'%value%' is an invalid UPC-A barcode
invalidLength;'%value%' is an invalid UPC-A barcode
notBetween;'%value%' is not between '%min%' and '%max%', inclusively
notBetweenStrict;'%value%' is not strictly between '%min%' and '%max%'
ccnumLength;'%value%' must contain between 13 and 19 digits
ccnumChecksum;Luhn algorithm (mod-10 checksum) failed on '%value%'
dateNotYYYY-MM-DD;'%value%' is not of the format YYYY-MM-DD
dateInvalid;'%value%' does not appear to be a valid date
dateFalseFormat;'%value%' does not fit given date format
notDigits;'%value%' contains not only digit characters
emailAddressInvalid;'%value%' is not a valid email address in the basic format local-part@hostname
emailAddressInvalidHostname;'%hostname%' is not a valid hostname for email address '%value%'
emailAddressInvalidMxRecord ;'%hostname%' does not appear to have a valid MX record for the email address '%value%'
emailAddressDotAtom;'%localPart%' not matched against dot-atom format
emailAddressQuotedString;'%localPart%' not matched against quoted-string format
emailAddressInvalidLocalPart;'%localPart%' is not a valid local part for email address '%value%'
notFloat;'%value%' does not appear to be a float
notGreaterThan;'%value%' is not greater than '%min%'
notHex;'%value%' has not only hexadecimal digit characters
hostnameIpAddressNotAllowed;'%value%' appears to be an IP address, but IP addresses are not allowed
hostnameUnknownTld;'%value%' appears to be a DNS hostname but cannot match TLD against known list
hostnameDashCharacter;'%value%' appears to be a DNS hostname but contains a dash (-) in an invalid position
hostnameInvalidHostnameSchema;'%value%' appears to be a DNS hostname but cannot match against hostname schema for TLD '%tld%'
hostnameUndecipherableTld;'%value%' appears to be a DNS hostname but cannot extract TLD part
hostnameInvalidHostname;'%value%' does not match the expected structure for a DNS hostname
hostnameInvalidLocalName;'%value%' does not appear to be a valid local network name
hostnameLocalNameNotAllowed;'%value%' appears to be a local network name but local network names are not allowed
notSame;Tokens do not match
missingToken;No token was provided to match against
notInArray;'%value%' was not found in the haystack
notInt;'%value%' does not appear to be an integer
notIpAddress;'%value%' does not appear to be a valid IP address
notLessThan;'%value%' is not less than '%max%'
isEmpty;Value is empty, but a non-empty value is required
regexNotMatch;'%value%' does not match against pattern '%pattern%'
stringLengthTooShort;'%value%' is less than %min% characters long
stringLengthTooLong;'%value%' is greater than %max% characters long
- Newer: Creating Custom Validators
- Older: Validation of Zend_Form
Comments:0
Trackbacks:0
- Trackback URL for this entry
- http://www.oplabo.com/article/12/trackback
- Listed below are links to weblogs that reference
- Standard Validators of Zend Framework from Open Programming Laboratory