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


Detailed Description

Class to represent a form validation check.

Definition at line 23 of file

Member Function Documentation

FormValidator::FormValidator ( $form,
  $validator = null 


$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

References $_field.

FormValidator::getField ( )

Get the field associated with the check.


Definition at line 84 of file

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

& FormValidator::getForm ( )

Get the form associated with the check


Definition at line 100 of file

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

FormValidator::getMessage ( )

Get the error message associated with a failed validation check.


Definition at line 92 of file

FormValidator::getType ( )

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


Definition at line 116 of file

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

& FormValidator::getValidator ( )

Get the validator associated with the check


Definition at line 108 of file

References isEmptyAndOptional().

FormValidator::isEmptyAndOptional ( )

Check if field value is empty and optional.


Definition at line 165 of file

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.


Definition at line 129 of file

Member Data Documentation

string FormValidator::$_field

The name of the field

Definition at line 35 of file

Referenced by FormValidator().

Form FormValidator::$_form

The Form associated with the check

Definition at line 29 of file

string FormValidator::$_message

The error message associated with a validation failure

Definition at line 47 of file

string FormValidator::$_type

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

Definition at line 41 of file

Validator FormValidator::$_validator

The validator used to validate the field

Definition at line 53 of file

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