Open Monograph Press  1.1
 All Classes Namespaces Functions Variables Groups Pages
FormValidatorCustom Class Reference
Inheritance diagram for FormValidatorCustom:

Public Member Functions

 FormValidatorCustom (&$form, $field, $type, $message, $userFunction, $additionalArguments=array(), $complementReturn=false)
 isValid ()
- Public Member Functions inherited from FormValidator
 FormValidator (&$form, $field, $type, $message, $validator=null)
 getField ()
 getFieldValue ()
getForm ()
 getMessage ()
 getType ()
getValidator ()
 isEmptyAndOptional ()
 isValid ()

Public Attributes

- Public Attributes inherited from FormValidator

Detailed Description

Form validation check with a custom user function performing the validation check.

Definition at line 18 of file

Member Function Documentation

FormValidatorCustom::FormValidatorCustom ( $form,
  $additionalArguments = array(),
  $complementReturn = false 

Constructor. The user function is passed the form data as its first argument and $additionalArguments, if set, as the remaining arguments. This function must return a boolean value.

$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)
$userFunctioncallable function the user function to use for validation
$additionalArgumentsarray optional, a list of additional arguments to pass to $userFunction
$complementReturnboolean optional, complement the value returned by $userFunction

Definition at line 49 of file

References FormValidator\getFieldValue(), and FormValidator\isEmptyAndOptional().

FormValidatorCustom::isValid ( )
See Also
FormValidator::isValid() Value is valid if it is empty and optional or validated by user-supplied function.

Definition at line 65 of file

Member Data Documentation

array FormValidatorCustom::$_additionalArguments

Additional arguments to pass to $userFunction

Definition at line 30 of file

boolean FormValidatorCustom::$_complementReturn

If true, field is considered valid if user function returns false instead of true

Definition at line 36 of file

callable FormValidatorCustom::$_userFunction

Custom validation function

Definition at line 24 of file

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