Open Journal Systems  2.4.3
 All Classes Namespaces Functions Variables Groups Pages
FormValidator Class Reference
Inheritance diagram for FormValidator:
FormValidatorAlphaNum FormValidatorArray FormValidatorArrayCustom FormValidatorBoolean FormValidatorCaptcha 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 ()
 
 setForm (&$form)
 

Detailed Description

Class to represent a form validation check.

Definition at line 24 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 49 of file FormValidator.inc.php.

FormValidator::getField ( )

Get the field associated with the check.

Returns
string

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

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.

Returns
string

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

FormValidator::getType ( )

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

Returns
string

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

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

& FormValidator::getValidator ( )

Get the validator associated with the check

Returns
Validator

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

Referenced by isValid().

FormValidator::isEmptyAndOptional ( )

Check if field value is empty and optional.

Returns
boolean

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

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.

Returns
boolean

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

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 http://pkp.sfu.ca/wiki/index.php/Information_for_Developers#Use_of_.24this_in_the_constructor for a full explanation.

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


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