Open Journal Systems  2.4.8
 All Classes Namespaces Functions Variables Groups Pages
FormValidator Class Reference
Inheritance diagram for FormValidator:
FormValidatorAlphaNum FormValidatorArray FormValidatorArrayCustom FormValidatorBoolean FormValidatorCaptcha FormValidatorControlledVocab FormValidatorCustom FormValidatorDate FormValidatorEmail FormValidatorInSet FormValidatorISSN FormValidatorLength FormValidatorListbuilder FormValidatorLocale FormValidatorORCID FormValidatorPost FormValidatorReCaptcha FormValidatorRegExp FormValidatorUri FormValidatorUrl

Public Member Functions

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

Detailed Description

Class to represent a form validation check.

Definition at line 24 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 49 of file

FormValidator::getField ( )

Get the field associated with the check.


Definition at line 70 of file

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

& FormValidator::getForm ( )
FormValidator::getMessage ( )

Get the error message associated with a failed validation check.


Definition at line 78 of file

FormValidator::getType ( )

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


Definition at line 113 of file

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

& FormValidator::getValidator ( )

Get the validator associated with the check


Definition at line 105 of file

Referenced by isValid().

FormValidator::isEmptyAndOptional ( )

Check if field value is empty and optional.


Definition at line 162 of file

References getFieldValue(), and getType().

Referenced by FormValidatorInSet\isValid(), FormValidatorLength\isValid(), FormValidatorCustom\isValid(), FormValidatorArrayCustom\isValid(), and isValid().

FormValidator::isValid ( )

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


Definition at line 126 of file

References getFieldValue(), getValidator(), and isEmptyAndOptional().

FormValidator::setForm ( $form)

Set the form associated with this check. Used only for PHP4 compatibility when instantiating without =& (which is deprecated). SHOULD NOT BE USED otherwise. See for a full explanation.

Definition at line 89 of file

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