Class Validator
This validation class handles all form and custom form validation through the use of Required fields.
Relies on javascript for client-side validation, and marking fields after serverside validation.
Acts as a visitor to individual form fields.
- Object
-
Validator
Direct known subclasses
Indirect known subclasses
Methods summary
public static
|
#
set_javascript_validation_handler( mixed $handler )
Call this function to set the javascript validation handler for all
valdiation on your site. This could be called from _config.php to set site-wide
javascript validation, or from ContentController::init() to affect only the
front-end site. Use instance method |
public static
string
|
#
get_javascript_validator_handler( )
Returns global validation handler used for all forms by default, unless
overwritten by |
public
|
#
setJavascriptValidationHandler( string $handler )
Set JavaScript validation for this validator. Use static method |
public
string
|
#
getJavascriptValidationHandler( )
Gets the current javascript validation handler for this form. If not set,
falls back to the global static |
public
|
|
public
array
|
|
public
|
#
validationError( mixed $fieldName, mixed $message, mixed $messageType = '' )
Callback to register an error on a field (Called from implementations of
|
public
|
|
public
|
|
public
|
|
public
array
|
#
getErrors( )
Returns all errors found by a previous call to
|
public
|
|
public
|
|
public
|
#
fieldIsRequired( mixed $fieldName )
Returns true if the named field is "required". Used by FormField to return a value for FormField::Required(), to do things like show *s on the form template. By default, it always returns false. |
abstract public
|
|
abstract public
|
Methods inherited from Object
__call(),
__construct(),
__toString(),
__wakeup(),
addMethodsFrom(),
addStaticVars(),
addWrapperMethod(),
add_extension(),
add_static_var(),
allMethodNames(),
cacheToFile(),
cacheToFileWithArgs(),
clearCache(),
combined_static(),
create(),
createMethod(),
create_from_string(),
defineMethods(),
exists(),
extInstance(),
extend(),
getCustomClass(),
getExtensionInstance(),
getExtensionInstances(),
get_extensions(),
get_static(),
hasExtension(),
hasMethod(),
has_extension(),
invokeWithExtensions(),
is_a(),
loadCache(),
parentClass(),
parse_class_spec(),
remove_extension(),
sanitiseCachename(),
saveCache(),
set_stat(),
set_static(),
set_uninherited(),
stat(),
strong_create(),
uninherited(),
uninherited_static(),
useCustomClass()
Magic methods summary
Properties summary
protected
|
$form |
#
$form |
protected
array
|
$errors |
#
$errors |
protected static
string
|
$javascript_validation_handler |
#
Static for default value of $this->javascriptValidationHandler. Set with Validator::set_javascript_validation_handler(); |
protected
string
|
$javascriptValidationHandler |
#
Handler for javascript validation. Can be "prototype" or "none". |