Previous Next

Validation Messages

Each validator which is based on Zend_Validate provides one or multiple messages in the case of a failed validation. You can use this information for setting own messages or when you have to translate the messages a validator can return. The following table lists all available messages which are returned by each validator.

Available Validation Messages
Validator Constant Message
Alnum NOT_ALNUM '%value%' has not only alphabetic and digit characters
STRING_EMPTY '%value%' is an empty string
Alpha NOT_ALPHA '%value%' has not only alphabetic characters
STRING_EMPTY '%value%' is an empty string
Barcode --- messages are thrown by a subclass
Barcode_Ean13 INVALID '%value%' is an invalid EAN-13 barcode
INVALID_LENGTH '%value%' should be 13 characters
NOT_NUMERIC '%value%' should contain only numeric characters
Barcode_UpcA INVALID '%value%' is an invalid UPC-A barcode
INVALID_LENGTH '%value%' should be 12 characters
Between NOT_BETWEEN '%value%' is not between '%min%' and '%max%', inclusively
NOT_BETWEEN_STRICT '%value%' is not strictly between '%min%' and '%max%'
Ccnum LENGTH '%value%' must contain between 13 and 19 digits
CHECKSUM Luhn algorithm (mod-10 checksum) failed on '%value%'
Date FALSEFORMAT '%value%' does not fit given date format
INVALID '%value%' does not appear to be a valid date
NOT_YYYY_MM_DD '%value%' is not of the format YYYY-MM-DD
Db_Abstract ERROR_NO_RECORD_FOUND No record matching %value% was found
ERROR_RECORD_FOUND A record matching %value% was found
Digits NOT_DIGITS '%value%' contains not only digit characters
STRING_EMPTY '%value%' is an empty string
EmailAddress INVALID '%value%' is not a valid email address in the basic format local-part@hostname
INVALID_HOSTNAME '%hostname%' is not a valid hostname for email address '%value%'
INVALID_MX_RECORD '%hostname%' does not appear to have a valid MX record for the email address '%value%'
DOT_ATOM '%localPart%' not matched against dot-atom format
QUOTED_STRING '%localPart%' not matched against quoted-string format
INVALID_LOCAL_PART '%localPart%' is not a valid local part for email address '%value%'
LENGTH_EXCEEDED '%value%' exceeds the allowed length
File_Count TOO_MUCH Too much files, maximum '%max%' are allowed but '%count%' are given
TOO_LESS Too less files, minimum '%min%' are expected but '%count%' are given
File_Crc32 DOES_NOT_MATCH The file '%value%' does not match the given crc32 hashes
NOT_DETECTED There was no crc32 hash detected for the given file
NOT_FOUND The file '%value%' could not be found
File_ExcludeExtension FALSE_EXTENSION The file '%value%' has a false extension
NOT_FOUND The file '%value%' was not found
File_ExcludeMimeType FALSE_TYPE The file '%value%' has a false mimetype of '%type%'
NOT_DETECTED The mimetype of file '%value%' could not been detected
NOT_READABLE The file '%value%' can not be read
File_Exists DOES_NOT_EXIST The file '%value%' does not exist
File_Extension FALSE_EXTENSION The file '%value%' has a false extension
NOT_FOUND The file '%value%' was not found
File_FilesSize TOO_BIG All files in sum should have a maximum size of '%max%' but '%size%' were detected
TOO_SMALL All files in sum should have a minimum size of '%min%' but '%size%' were detected
NOT_READABLE One or more files can not be read
File_Hash DOES_NOT_MATCH The file '%value%' does not match the given hashes
NOT_DETECTED There was no hash detected for the given file
NOT_FOUND The file '%value%' could not be found
File_ImageSize WIDTH_TOO_BIG Maximum allowed width for image '%value%' should be '%maxwidth%' but '%width%' detected
WIDTH_TOO_SMALL Minimum expected width for image '%value%' should be '%minwidth%' but '%width%' detected
HEIGHT_TOO_BIG Maximum allowed height for image '%value%' should be '%maxheight%' but '%height%' detected
HEIGHT_TOO_SMALL Minimum expected height for image '%value%' should be '%minheight%' but '%height%' detected
NOT_DETECTED The size of image '%value%' could not be detected
NOT_READABLE The image '%value%' can not be read
File_IsCompressed FALSE_TYPE The file '%value%' is not compressed, '%type%' detected
NOT_DETECTED The mimetype of file '%value%' could not been detected
NOT_READABLE The file '%value%' can not be read
File_IsImage FALSE_TYPE The file '%value%' is no image, '%type%' detected
NOT_DETECTED The mimetype of file '%value%' could not been detected
NOT_READABLE The file '%value%' can not be read
File_Md5 DOES_NOT_MATCH The file '%value%' does not match the given md5 hashes
NOT_DETECTED There was no md5 hash detected for the given file
NOT_FOUND The file '%value%' could not be found
File_MimeType FALSE_TYPE The file '%value%' has a false mimetype of '%type%'
NOT_DETECTED The mimetype of file '%value%' could not been detected
NOT_READABLE The file '%value%' can not be read
File_NotExists DOES_EXIST The file '%value%' does exist
File_Sha1 DOES_NOT_MATCH The file '%value%' does not match the given sha1 hashes
NOT_DETECTED There was no sha1 hash detected for the given file
NOT_FOUND The file '%value%' could not be found
File_Size TOO_BIG Maximum allowed size for file '%value%' is '%max%' but '%size%' detected
TOO_SMALL Minimum expected size for file '%value%' is '%min%' but '%size%' detected
NOT_FOUND The file '%value%' could not be found
File_Upload INI_SIZE The file '%value%' exceeds the defined ini size
FORM_SIZE The file '%value%' exceeds the defined form size
PARTIAL The file '%value%' was only partially uploaded
NO_FILE The file '%value%' was not uploaded
NO_TMP_DIR No temporary directory was found for the file '%value%'
CANT_WRITE The file '%value%' can't be written
EXTENSION The extension returned an error while uploading the file '%value%'
ATTACK The file '%value%' was illegal uploaded, possible attack
FILE_NOT_FOUND The file '%value%' was not found
UNKNOWN Unknown error while uploading the file '%value%'
File_WordCount TOO_MUCH Too much words, maximum '%max%' are allowed but '%count%' were counted
TOO_LESS Too less words, minimum '%min%' are expected but '%count%' were counted
NOT_FOUND The file '%value%' could not be found
Float NOT_FLOAT '%value%' does not appear to be a float
GreaterThan NOT_GREATER '%value%' is not greater than '%min%'
Hex NOT_HEX '%value%' has not only hexadecimal digit characters
Hostname IP_ADDRESS_NOT_ALLOWED '%value%' appears to be an IP address, but IP addresses are not allowed
UNKNOWN_TLD '%value%' appears to be a DNS hostname but cannot match TLD against known list
INVALID_DASH '%value%' appears to be a DNS hostname but contains a dash (-) in an invalid position
INVALID_HOSTNAME_SCHEMA '%value%' appears to be a DNS hostname but cannot match against hostname schema for TLD '%tld%'
UNDECIPHERABLE_TLD '%value%' appears to be a DNS hostname but cannot extract TLD part
INVALID_HOSTNAME '%value%' does not match the expected structure for a DNS hostname
INVALID_LOCAL_NAME '%value%' does not appear to be a valid local network name
LOCAL_NAME_NOT_ALLOWED '%value%' appears to be a local network name but local network names are not allowed
Iban NOTSUPPORTED '%value%' does not have IBAN
FALSEFORMAT '%value%' has a false format
CHECKFAILED '%value%' has failed the IBAN check
Identical NOT_SAME Tokens do not match
MISSING_TOKEN No token was provided to match against
InArray NOT_IN_ARRAY '%value%' was not found in the haystack
Int NOT_INT '%value%' does not appear to be an integer
Ip NOT_IP_ADDRESS '%value%' does not appear to be a valid IP address
LessThan NOT_LESS '%value%' is not less than '%max%'
NotEmpty IS_EMPTY Value is required and can't be empty
Regex NOT_MATCH '%value%' does not match against pattern '%pattern%'
StringLength TOO_SHORT '%value%' is less than %min% characters long
TOO_LONG '%value%' is greater than %max% characters long

Additionally you can retrieve all message templates of a validator with the method getMessageTemplates(). It returns you an array with the messages a validator could return in the case of a failed validation.

$validator = new Zend_Validate_Alnum();
$messages  = $validator->getMessageTemplates();
Previous Next
Introduction to Zend Framework
Overview
Installation
Zend_Acl
Introduction
Refining Access Controls
Advanced Usage
Zend_Amf
Introduction
Zend_Amf_Server
Zend_Application
Introduction
Zend_Application Quick Start
Theory of Operation
Examples
Core Functionality
Available Resource Plugins
Zend_Auth
Introduction
Database Table Authentication
Digest Authentication
HTTP Authentication Adapter
LDAP Authentication
Open ID Authentication
Zend_Cache
Introduction
The Theory of Caching
Zend_Cache Frontends
Zend_Cache Backends
Zend_Captcha
Introduction
Captcha Operation
CAPTCHA Adapters
Zend_CodeGenerator
Introduction
Zend_CodeGenerator Examples
Zend_CodeGenerator Reference
Zend_Config
Introduction
Theory of Operation
Zend_Config_Ini
Zend_Config_Xml
Zend_Config_Writer
Zend_Config_Writer
Zend_Console_Getopt
Introduction
Declaring Getopt Rules
Fetching Options and Arguments
Configuring Zend_Console_Getopt
Zend_Controller
Zend_Controller Quick Start
Zend_Controller Basics
The Front Controller
The Request Object
The Standard Router
The Dispatcher
Action Controllers
Action Helpers
The Response Object
Plugins
Using a Conventional Modular Directory Structure
MVC Exceptions
Migrating from Previous Versions
Zend_Currency
Introduction to Zend_Currency
How to Work with Currencies
Migrating from Previous Versions
Zend_Date
Introduction
Theory of Operation
Basic Methods
Zend_Date API Overview
Creation of Dates
Constants for General Date Functions
Working Examples
Zend_Db
Zend_Db_Adapter
Zend_Db_Statement
Zend_Db_Profiler
Zend_Db_Select
Zend_Db_Table
Zend_Db_Table_Row
Zend_Db_Table_Rowset
Zend_Db_Table Relationships
Zend_Debug
Dumping Variables
Zend_Dojo
Introduction
Zend_Dojo_Data: dojo.data Envelopes
Dojo View Helpers
Dojo Form Elements and Decorators
Zend_Dom
Introduction
Zend_Dom_Query
Zend_Exception
Using Exceptions
Zend_Feed
Introduction
Importing Feeds
Retrieving Feeds from Web Pages
Consuming an RSS Feed
Consuming an Atom Feed
Consuming a Single Atom Entry
Modifying Feed and Entry structures
Custom Feed and Entry Classes
Zend_File
Zend_File_Transfer
Validators for Zend_File_Transfer
Filters for Zend_File_Transfer
Migrating from previous versions
Zend_Filter
Introduction
Standard Filter Classes
Filter Chains
Writing Filters
Zend_Filter_Input
Zend_Filter_Inflector
Zend_Form
Zend_Form
Zend_Form Quick Start
Creating Form Elements Using Zend_Form_Element
Creating Forms Using Zend_Form
Creating Custom Form Markup Using Zend_Form_Decorator
Standard Form Elements Shipped With Zend Framework
Standard Form Decorators Shipped With Zend Framework
Internationalization of Zend_Form
Advanced Zend_Form Usage
Zend_Gdata
Introduction
Authenticating with AuthSub
Using the Book Search Data API
Authenticating with ClientLogin
Using Google Calendar
Using Google Documents List Data API
Using Google Health
Using Google Spreadsheets
Using Google Apps Provisioning
Using Google Base
Using Picasa Web Albums
Using the YouTube Data API
Catching Gdata Exceptions
Zend_Http
Introduction
Zend_Http_Client - Advanced Usage
Zend_Http_Client - Connection Adapters
Zend_Http_Cookie and Zend_Http_CookieJar
Zend_Http_Response
Zend_InfoCard
Introduction
Zend_Json
Introduction
Basic Usage
Advanced Usage of Zend_Json
XML to JSON conversion
Zend_Json_Server - JSON-RPC server
Zend_Layout
Introduction
Zend_Layout Quick Start
Zend_Layout Configuration Options
Zend_Layout Advanced Usage
Zend_Ldap
Introduction
Zend_Loader
Loading Files and Classes Dynamically
The Autoloader
Resource Autoloaders
Loading Plugins
Zend_Locale
Introduction
Using Zend_Locale
Normalization and Localization
Working with Dates and Times
Supported locales
Migrating from previous versions
Zend_Log
Overview
Writers
Formatters
Filters
Zend_Mail
Introduction
Sending via SMTP
Sending Multiple Mails per SMTP Connection
Using Different Transports
HTML E-Mail
Attachments
Adding Recipients
Controlling the MIME Boundary
Additional Headers
Character Sets
Encoding
SMTP Authentication
Securing SMTP Transport
Reading Mail Messages
Zend_Measure
Introduction
Creation of Measurements
Outputting measurements
Manipulating Measurements
Types of measurements
Zend_Memory
Overview
Memory Manager
Memory Objects
Zend_Mime
Zend_Mime
Zend_Mime_Message
Zend_Mime_Part
Zend_Navigation
Introduction
Pages
Containers
Zend_OpenId
Introduction
Zend_OpenId_Consumer Basics
Zend_OpenId_Provider
Zend_Paginator
Introduction
Usage
Configuration
Advanced usage
Zend_Pdf
Introduction
Creating and Loading PDF Documents
Save Changes to PDF Documents
Working with Pages
Drawing
Document Info and Metadata.
Zend_Pdf module usage example
Zend_ProgressBar
Zend_ProgressBar
Zend_Reflection
Introduction
Zend_Reflection Examples
Zend_Reflection Reference
Zend_Registry
Using the Registry
Zend_Rest
Introduction
Zend_Rest_Client
Zend_Rest_Server
Zend_Search_Lucene
Overview
Building Indexes
Searching an Index
Query Language
Query Construction API
Character Set
Extensibility
Interoperating with Java Lucene
Advanced
Best Practices
Zend_Server
Introduction
Zend_Server_Reflection
Zend_Service
Introduction
Zend_Service_Akismet
Zend_Service_Amazon
Zend_Service_Amazon_Ec2
Zend_Service_Amazon_Ec2: Instances
Zend_Service_Amazon_Ec2: Windows Instances
Zend_Service_Amazon_Ec2: Reserved Instances
Zend_Service_Amazon_Ec2: CloudWatch Monitoring
Zend_Service_Amazon_Ec2: Amazon Machine Images (AMI)
Zend_Service_Amazon_Ec2: Elastic Block Stroage (EBS)
Zend_Service_Amazon_Ec2: Elastic IP Addresses
Zend_Service_Amazon_Ec2: Keypairs
Zend_Service_Amazon_Ec2: Regions and Availability Zones
Zend_Service_Amazon_Ec2: Security Groups
Zend_Service_Amazon_S3
Zend_Service_Audioscrobbler
Zend_Service_Delicious
Zend_Service_Flickr
Zend_Service_Nirvanix
Zend_Service_ReCaptcha
Zend_Service_Simpy
Introduction
Zend_Service_StrikeIron
Zend_Service_StrikeIron: Bundled Services
Zend_Service_StrikeIron: Advanced Uses
Zend_Service_Technorati
Zend_Service_Twitter
Zend_Service_Yahoo
Zend_Session
Introduction
Basic Usage
Advanced Usage
Global Session Management
Zend_Session_SaveHandler_DbTable
Zend_Soap
Zend_Soap_Server
Zend_Soap_Client
WSDL Accessor
AutoDiscovery
Zend_Tag
Introduction
Zend_Tag_Cloud
Zend_Test
Introduction
Zend_Test_PHPUnit
Zend_Text
Zend_Text_Figlet
Zend_Text_Table
Zend_TimeSync
Introduction
Working with Zend_TimeSync
Zend_Tool_Framework
Introduction
Using the CLI Tool
Architecture
Creating Providers to use with Zend_Tool_Framework
Shipped System Providers
Zend_Tool_Project
Zend_Tool_Project Introduction
Create A Project
Zend Tool Project Providers
Zend_Translate
Introduction
Adapters for Zend_Translate
Using Translation Adapters
Migrating from previous versions
Zend_Uri
Zend_Uri
Zend_Validate
Introduction
Standard Validation Classes
Validator Chains
Writing Validators
Validation Messages
Zend_Version
Getting the Zend Framework Version
Zend_View
Introduction
Controller Scripts
View Scripts
View Helpers
Zend_View_Abstract
Migrating from Previous Versions
Zend_Wildfire
Zend_Wildfire
Zend_XmlRpc
Introduction
Zend_XmlRpc_Client
Zend_XmlRpc_Server
Zend Framework Requirements
Introduction
Zend Framework Coding Standard for PHP
Overview
PHP File Formatting
Naming Conventions
Coding Style
Zend Framework Performance Guide
Introduction
Class Loading
Zend_Db Performance
Internationalization (i18n) and Localization (l10n)
View Rendering
Copyright Information