Public Member Functions | Static Public Member Functions | Data Fields
InvalidFieldException Class Reference

Thrown when validating an incorrect form. More...

Inheritance diagram for InvalidFieldException:

Public Member Functions

 InvalidFieldException ($message_code, $field_name=null, $required_value= '', $code=0, Exception $previous=null)
 
 getFieldName ()
 

Static Public Member Functions

static generateMessage ($message_code, $field_name= '', $required_value= '')
 

Data Fields

 $messages
 
 $field_name
 

Detailed Description

Thrown when validating an incorrect form.

Version
1.1
Author
DinuSV

Member Function Documentation

InvalidFieldException (   $message_code,
  $field_name = null,
  $required_value = '',
  $code = 0,
Exception  $previous = null 
)

Constructor

Parameters
string$message_code: [optional] message to output
string$field_name: [optional] name of the field the exception was thrown for
string$required_value: [optional]
int$code: [optional]
Exception$previous: [optional]
See Also
php exception
static generateMessage (   $message_code,
  $field_name = '',
  $required_value = '' 
)
static

Generates form validation message according to the messagecode given

Parameters
string$message_code: code for the message
string$field_name: [optional] name of the field the exception was thrown for
string$required_value: [optional] value required for the field
Returns
string
getFieldName ( )

Get the field the exception was trown for

Returns
string

Field Documentation

$messages
Initial value:
= array(
FormValidation::REQUIRED => 'This field is required',
FormValidation::MINIMUM_LENGTH => 'Field must be at least %required characters long',
FormValidation::MAXIMUM_LENGTH => 'Field must be maximum %required characters long',
FormValidation::RANGE_LENGTH => 'Field must be between %required characters long',
FormValidation::PREG_MATCH => 'Field does not match requirements',
FormValidation::EMAIL => 'Field must be a valid email address',
FormValidation::EMAIL_MULTIPLE => 'Field must contain valid email adresses',
FormValidation::NUMBER => 'Field must be a valid number',
FormValidation::NUMERIC => 'Field must be numeric',
FormValidation::GREATER_THAN => 'Value must be greater than %required',
FormValidation::LESS_THAN => 'Value must be less than %required',
FormValidation::EQUALS => 'Field must match %required value',
FormValidation::EQUALS_FIELD => 'Field must match %required field',
FormValidation::ALPHA => 'Field must contain only letters'
)

array : map of field required-types and their messages

$field_name

string : Name of the field the exception was thrown for