Open Monograph Press  1.1
 All Classes Namespaces Functions Variables Groups Pages
FormValidator Class Reference
Inheritance diagram for FormValidator:
FormValidatorAlphaNum FormValidatorArray FormValidatorArrayCustom FormValidatorBoolean FormValidatorControlledVocab FormValidatorCustom FormValidatorEmail FormValidatorInSet FormValidatorISSN FormValidatorLength FormValidatorListbuilder FormValidatorLocale FormValidatorPost FormValidatorReCaptcha FormValidatorRegExp FormValidatorUri FormValidatorUrl

Public Member Functions

 FormValidator (&$form, $field, $type, $message, $validator=null)
 
 getField ()
 
 getFieldValue ()
 
getForm ()
 
 getMessage ()
 
 getType ()
 
getValidator ()
 
 isEmptyAndOptional ()
 
 isValid ()
 

Public Attributes

 $_field
 
 $_form
 
 $_message
 
 $_type
 
 $_validator
 

Detailed Description

Class to represent a form validation check.

Definition at line 23 of file FormValidator.inc.php.

Member Function Documentation

FormValidator::FormValidator ( $form,
  $field,
  $type,
  $message,
  $validator = null 
)

Constructor.

Parameters
$formForm the associated form
$fieldstring the name of the associated field
$typestring the type of check, either "required" or "optional"
$messagestring the error message for validation failures (i18n key)
$validatorValidator the validator used to validate this form field (optional)

Definition at line 63 of file FormValidator.inc.php.

References $_field.

FormValidator::getField ( )

Get the field associated with the check.

Returns
string

Definition at line 84 of file FormValidator.inc.php.

Referenced by FormValidatorBoolean\isValid(), FormValidatorArray\isValid(), and FormValidatorArrayCustom\isValid().

& FormValidator::getForm ( )

Get the form associated with the check

Returns
Form

Definition at line 100 of file FormValidator.inc.php.

Referenced by FormValidatorReCaptcha\FormValidatorReCaptcha(), and FormValidatorBoolean\isValid().

FormValidator::getMessage ( )

Get the error message associated with a failed validation check.

Returns
string

Definition at line 92 of file FormValidator.inc.php.

FormValidator::getType ( )

Get the type of the validated field ('optional' or 'required')

Returns
string

Definition at line 116 of file FormValidator.inc.php.

Referenced by FormValidatorArray\getErrorFields(), and FormValidatorArrayCustom\isLocaleField().

& FormValidator::getValidator ( )

Get the validator associated with the check

Returns
Validator

Definition at line 108 of file FormValidator.inc.php.

References isEmptyAndOptional().

FormValidator::isEmptyAndOptional ( )

Check if field value is empty and optional.

Returns
boolean

Definition at line 165 of file FormValidator.inc.php.

Referenced by FormValidatorCustom\FormValidatorCustom(), FormValidatorLength\FormValidatorLength(), and getValidator().

FormValidator::isValid ( )

Check if field value is valid. Default check is that field is either optional or not empty.

Returns
boolean

Definition at line 129 of file FormValidator.inc.php.

Member Data Documentation

string FormValidator::$_field

The name of the field

Definition at line 35 of file FormValidator.inc.php.

Referenced by FormValidator().

Form FormValidator::$_form

The Form associated with the check

Definition at line 29 of file FormValidator.inc.php.

string FormValidator::$_message

The error message associated with a validation failure

Definition at line 47 of file FormValidator.inc.php.

string FormValidator::$_type

The type of check ("required" or "optional")

Definition at line 41 of file FormValidator.inc.php.

Validator FormValidator::$_validator

The validator used to validate the field

Definition at line 53 of file FormValidator.inc.php.


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