ValidForm Builder API Documentation

FieldValidator extends ClassDynamic
in package

FieldValidator Class

This class handles all the validation logic

Tags
author

Felix Langfeldt [email protected]

author

Robin van Baalen [email protected]

version
5.3.0

Table of Contents

Methods

__call()  : mixed
Magic caller method
__construct()  : mixed
Construct new validation object
__get()  : mixed
Magic getter method
__set()  : mixed
Magic setter method
getCheck()  : string
Get the validation rule (regular expression)
getDefaultRequired()  : bool
getError()  : string
Get error message
getExternalValidation()  : array<string|int, mixed>|null
getExternalValidationError()  : string
getField()  : Base
getFieldHint()  : string
getFieldName()  : string
getFileTypes()  : array<string|int, mixed>
getHintError()  : string
getMatchWith()  : Element
getMatchWithError()  : string
getMaxFiles()  : int
getMaxLength()  : int
getMaxLengthError()  : string
getMaxSize()  : int
getMaxValue()  : int
getMaxValueError()  : string
getMinLength()  : int
getMinLengthError()  : string
getMinValue()  : int
getMinValueError()  : string
getOnlyListItems()  : int
getOnlyListItemsError()  : string
getRequired()  : bool
Get required state
getRequiredError()  : string
getSanitisers()  : array<string|int, mixed>|null
getType()  : int
getTypeError()  : string
getValidation()  : string
getValidValue()  : array<string|int, mixed>|string
Get the validated value
getValue()  : string|array<string|int, mixed>|null
Get the value to validate from either the global request variable or the cached __validvalues array.
preSanitize()  : string
Pre-sanitize a value using a given set of sanitisers or the preset list already available.
sanitize()  : string
Sanitize a value according to preset rules.
setDefaultRequired()  : void
setError()  : mixed
Set custom error on a field
setExternalValidation()  : void
setExternalValidationError()  : void
setField()  : void
setFieldHint()  : void
setFieldName()  : void
setFileTypes()  : void
setHintError()  : void
setMatchWith()  : void
setMatchWithError()  : void
setMaxFiles()  : void
setMaxLength()  : void
setMaxLengthError()  : void
setMaxSize()  : void
setMaxValue()  : void
setMaxValueError()  : void
setMinLength()  : void
setMinLengthError()  : void
setMinValue()  : void
setMinValueError()  : void
setOnlyListItems()  : void
setOnlyListItemsError()  : void
setRequired()  : mixed
Set required state
setRequiredError()  : void
setSanitisers()  : void
setType()  : void
setTypeError()  : void
setValidation()  : void
validate()  : bool
The most important function of ValidForm Builder library.

Methods

__call()

Magic caller method

public __call(string $method, mixed $values) : mixed
Parameters
$method : string
$values : mixed
Tags
throws
BadMethodCallException

__construct()

Construct new validation object

public __construct(Element $objField[, array<string|int, mixed> $arrValidationRules = array() ][, array<string|int, mixed> $arrErrorHandlers = array() ][, array<string|int, mixed> $arrSanitizationRules = null ]) : mixed
Parameters
$objField : Element
$arrValidationRules : array<string|int, mixed> = array()
$arrErrorHandlers : array<string|int, mixed> = array()
$arrSanitizationRules : array<string|int, mixed> = null

__get()

Magic getter method

public __get(string $property) : mixed
Parameters
$property : string
Tags
throws
BadMethodCallException

__set()

Magic setter method

public __set(string $property, mixed $value) : mixed
Parameters
$property : string
$value : mixed
Tags
throws
BadMethodCallException

getCheck()

Get the validation rule (regular expression)

public getCheck() : string
Return values
string

getDefaultRequired()

public getDefaultRequired() : bool

getDefaultRequired() Returns the value of $__defaultRequired

Return values
bool

getError()

Get error message

public getError([int $intDynamicPosition = 0 ]) : string
Parameters
$intDynamicPosition : int = 0
Return values
string

getExternalValidation()

public getExternalValidation() : array<string|int, mixed>|null

getExternalValidation() Returns the value of $__externalvalidation

Return values
array<string|int, mixed>|null

getExternalValidationError()

public getExternalValidationError() : string

getExternalValidationError() Returns the value of $__externalvalidationerror

Return values
string

getFieldHint()

public getFieldHint() : string

getFieldHint() Returns the value of $__fieldhint

Return values
string

getFieldName()

public getFieldName() : string

getFieldName() Returns the value of $__fieldname

Return values
string

getFileTypes()

public getFileTypes() : array<string|int, mixed>

getFileTypes() Returns the value of $__filetypes

Return values
array<string|int, mixed>

getHintError()

public getHintError() : string

getHintError() Returns the value of $__hinterror

Return values
string

getMatchWithError()

public getMatchWithError() : string

getMatchWithError() Returns the value of $__onlylistitemserror

Return values
string

getMaxFiles()

public getMaxFiles() : int

getMaxFiles() Returns the value of $__maxfiles

Return values
int

getMaxLength()

public getMaxLength() : int

getMaxLength() Returns the value of $__maxlength

Return values
int

getMaxLengthError()

public getMaxLengthError() : string

getMaxLengthError() Returns the value of $__maxlengtherror

Return values
string

getMaxSize()

public getMaxSize() : int

getMaxSize() Returns the value of $__maxsize

Return values
int

getMaxValue()

public getMaxValue() : int

getMaxValue() Returns the value of $__maxvalue

Return values
int

getMaxValueError()

public getMaxValueError() : string

getMaxValueError() Returns the value of $__maxvalueerror

Return values
string

getMinLength()

public getMinLength() : int

getMinLength() Returns the value of $__minlength

Return values
int

getMinLengthError()

public getMinLengthError() : string

getMinLengthError() Returns the value of $__minlengtherror

Return values
string

getMinValue()

public getMinValue() : int

getMinValue() Returns the value of $__minvalue

Return values
int

getMinValueError()

public getMinValueError() : string

getMinValueError() Returns the value of $__minvalueerror

Return values
string

getOnlyListItems()

public getOnlyListItems() : int

getOnlyListItems() Returns the value of $__onlylistitems

Return values
int

getOnlyListItemsError()

public getOnlyListItemsError() : string

getOnlyListItemsError() Returns the value of $__onlylisterror

Return values
string

getRequired()

Get required state

public getRequired([bool $blnDefault = false ]) : bool
Parameters
$blnDefault : bool = false
Return values
bool

getRequiredError()

public getRequiredError() : string

getRequiredError() Returns the value of $__requirederror

Return values
string

getSanitisers()

public getSanitisers() : array<string|int, mixed>|null

getSanitisers() Returns the value of $__sanitisers

Return values
array<string|int, mixed>|null

getType()

public getType() : int

getType() Returns the value of $__type

Return values
int

getTypeError()

public getTypeError() : string

getTypeError() Returns the value of $__typeerror

Return values
string

getValidation()

public getValidation() : string

getValidation() Returns the value of $__validation

Return values
string

getValidValue()

Get the validated value

public getValidValue([int $intDynamicPosition = 0 ]) : array<string|int, mixed>|string
Parameters
$intDynamicPosition : int = 0
Return values
array<string|int, mixed>|string

getValue()

Get the value to validate from either the global request variable or the cached __validvalues array.

public getValue([int $intDynamicPosition = 0 ]) : string|array<string|int, mixed>|null
Parameters
$intDynamicPosition : int = 0

Using the intDynamicPosition parameter, you can get the specific value of a dynamic field.

Return values
string|array<string|int, mixed>|null

Returns the submitted field value. If no sumitted value is set, return value is the cached valid value. If no cached value is set, return value is the default value. If no default value is set, return value is null. When field type is ValidForm::VFORM_FILE and a file is submitted, the return value is the $_FILES[fieldname] array.

preSanitize()

Pre-sanitize a value using a given set of sanitisers or the preset list already available.

public preSanitize(mixed $varValue[, null|array<string|int, mixed> $arrSanitisers = null ]) : string
Parameters
$varValue : mixed
$arrSanitisers : null|array<string|int, mixed> = null
Return values
string

sanitize()

Sanitize a value according to preset rules.

public sanitize(mixed $varValue[, null|array<string|int, mixed> $arrSanitisers = null ]) : string
Parameters
$varValue : mixed
$arrSanitisers : null|array<string|int, mixed> = null
Return values
string

setDefaultRequired()

public setDefaultRequired() : void

setDefaultRequired(boolean $value) Overwrites the value of $__defaultRequired

setError()

Set custom error on a field

public setError(string $strError[, int $intDynamicPosition = 0 ]) : mixed

Use this to set a custom error on a field

Parameters
$strError : string

Custom error message

$intDynamicPosition : int = 0

setExternalValidation()

public setExternalValidation() : void

setExternalValidation(array $value) Overwrites the value of $__externalvalidation

setExternalValidationError()

public setExternalValidationError() : void

setExternalValidationError(string $value) Overwrites the value of $__externalvalidationerror

setField()

public setField() : void

setField(Base $value) Overwrites the value of $__field

setFieldHint()

public setFieldHint() : void

setFieldHint(string $value) Overwrites the value of $__fieldhint

setFieldName()

public setFieldName() : void

setFieldName(string $value) Overwrites the value of $__fieldname

setFileTypes()

public setFileTypes() : void

setFileTypes(array $value) Overwrites the value of $__filetypes

setHintError()

public setHintError() : void

setHintError(string $value) Overwrites the value of $__hinterror

setMatchWith()

public setMatchWith() : void

setMatchWith(Element $value) Overwrites the value of $__matchwith

setMatchWithError()

public setMatchWithError() : void

setMatchWithError(string $value) Overwrites the value of $__matchwitherror

setMaxFiles()

public setMaxFiles() : void

setMaxFiles(integer $value) Overwrites the value of $__maxfiles

setMaxLength()

public setMaxLength() : void

setMaxLength(integer $value) Overwrites the value of $__maxlength

setMaxLengthError()

public setMaxLengthError() : void

setMaxLengthError(string $value) Overwrites the value of $__maxlengtherror

setMaxSize()

public setMaxSize() : void

setMaxSize(integer $value) Overwrites the value of $__maxsize

setMaxValue()

public setMaxValue() : void

setMaxValue(float $value) Overwrites the value of $__maxvalue

setMaxValueError()

public setMaxValueError() : void

setMaxValueError(string $value) Overwrites the value of $__maxvalueerror

setMinLength()

public setMinLength() : void

setMinLength(integer $value) Overwrites the value of $__minlength

setMinLengthError()

public setMinLengthError() : void

setMinLengthError(string $value) Overwrites the value of $__minlengtherror

setMinValue()

public setMinValue() : void

setMinValue(float $value) Overwrites the value of $__minvalue

setMinValueError()

public setMinValueError() : void

setMinValueError(string $value) Overwrites the value of $__minvalueerror

setOnlyListItems()

public setOnlyListItems() : void

setOnlyListItems(bool $value) Overwrites the value of $__onlylistitems

setOnlyListItemsError()

public setOnlyListItemsError() : void

setOnlyListItemsError(string $value) Overwrites the value of $__onlylistitemserror

setRequired()

Set required state

public setRequired(bool $blnValue) : mixed
Parameters
$blnValue : bool

setRequiredError()

public setRequiredError() : void

setRequiredError(string $value) Overwrites the value of $__requirederror

setSanitisers()

public setSanitisers() : void

setSanitisers(array $value) Overwrites the value of $__sanitisers

setType()

public setType() : void

setType(integer $value) Overwrites the value of $__type

setTypeError()

public setTypeError() : void

setTypeError(string $value) Overwrites the value of $__typeerror

setValidation()

public setValidation() : void

setValidation(string $value) Overwrites the value of $__validation

validate()

The most important function of ValidForm Builder library.

public validate([int $intDynamicPosition = 0 ]) : bool

This function handles all the server-side field validation logic.

Parameters
$intDynamicPosition : int = 0

Using the intDynamicPosition parameter, you can validate a specific dynamic field, if necessary.

Return values
bool

True if the current field validates, false if not.


        
On this page

Search results