Static Public Member Functions

FormValidators Class Reference

List of all members.

Static Public Member Functions

static validate_url ($text, $control, $form, $warning=null, $schemes=array( 'http', 'https'))
static validate_email ($text, $control, $form, $warning=null)
static validate_required ($value, $control, $form, $warning=null)
static validate_username ($value, $control, $form, $allowed_name=null, $warning=null)
static validate_same ($value, $control, $form, $matcher, $warning=null)
static validate_regex ($value, $control, $container, $regex, $warning=null)
static validate_range ($value, $control, $container, $min, $max, $warning=null)

Detailed Description

FormValidators Class

Extend this class to supply your own validators, by default we supply most common

Definition at line 777 of file formui.php.


Member Function Documentation

static FormValidators::validate_email ( text,
control,
form,
warning = null 
) [static]

A validation function that returns an error if the value passed in is not a valid Email Address, as per RFC2822 and RFC2821.

Parameters:
string $text A string to test if it is a valid Email Address
FormControl $control The control that defines the value
FormContainer $form The container that holds the control
string $warning An optional error message
Returns:
array An empty array if the string is a valid Email Address, or an array with strings describing the errors

Definition at line 821 of file formui.php.

static FormValidators::validate_range ( value,
control,
container,
min,
max,
warning = null 
) [static]

A validation function that returns an error if the value passed is not within a specified range

Parameters:
string $value A value to test if it is empty
FormControl $control The control that defines the value
FormContainer $container The container that holds the control
float $min The minimum value, inclusive
float $max The maximum value, inclusive
string $warning An optional error message
Returns:
array An empty array if the value is value, or an array with strings describing the errors

Definition at line 926 of file formui.php.

static FormValidators::validate_regex ( value,
control,
container,
regex,
warning = null 
) [static]

A validation function that returns an error if the value passed does not match the regex specified.

Parameters:
string $value A value to test if it is empty
FormControl $control The control that defines the value
FormContainer $container The container that holds the control
string $regex The regular expression to test against
string $warning An optional error message
Returns:
array An empty array if the value exists, or an array with strings describing the errors

Definition at line 902 of file formui.php.

static FormValidators::validate_required ( value,
control,
form,
warning = null 
) [static]

A validation function that returns an error if the value passed in is not set.

Parameters:
string $text A value to test if it is empty
FormControl $control The control that defines the value
FormContainer $form The container that holds the control
string $warning An optional error message
Returns:
array An empty array if the value exists, or an array with strings describing the errors

Definition at line 841 of file formui.php.

static FormValidators::validate_same ( value,
control,
form,
matcher,
warning = null 
) [static]

A validation function that returns an error if the passed control values do not match

Parameters:
string $text A value to test for similarity
FormControl $control The control that defines the value
FormContainer $form The container that holds the control
FormControl $matcher The control which should have a matching value
string $warning An optional error message
Returns:
array An empty array if the value exists, or an array with strings describing the errors

Definition at line 883 of file formui.php.

static FormValidators::validate_url ( text,
control,
form,
warning = null,
schemes = array( 'http', 'https' ) 
) [static]

A validation function that returns an error if the value passed in is not a valid URL.

Parameters:
string $text A string to test if it is a valid URL
FormControl $control The control that defines the value
FormContainer $form The container that holds the control
string $warning An optional error message
Returns:
array An empty array if the string is a valid URL, or an array with strings describing the errors

Definition at line 789 of file formui.php.

static FormValidators::validate_username ( value,
control,
form,
allowed_name = null,
warning = null 
) [static]

A validation function that returns an error if the the passed username is unavailable

Parameters:
string $text A value to test as username
FormControl $control The control that defines the value
FormContainer $form The container that holds the control
string $allowed_name An optional name which overrides the check and is always allowed
string $warning An optional error message
Returns:
array An empty array if the value exists, or an array with strings describing the errors

Definition at line 860 of file formui.php.


The documentation for this class was generated from the following file: