Methods

__get()

__get(string  $property) 

Magic getter method

Parameters

string $property

Throws

\BadMethodCallException

__set()

__set(string  $property, mixed  $value) 

Magic setter method

Parameters

string $property
mixed $value

Throws

\BadMethodCallException

__call()

__call(string  $method, mixed  $values) 

Magic caller method

Parameters

string $method
mixed $values

Throws

\BadMethodCallException

__construct()

__construct(\ValidFormBuilder\Element  $objField, array  $arrValidationRules = array(), array  $arrErrorHandlers = array(), array  $arrSanitizationRules = null) 

Construct new validation object

Parameters

\ValidFormBuilder\Element $objField
array $arrValidationRules
array $arrErrorHandlers
array $arrSanitizationRules

getValidValue()

getValidValue(integer  $intDynamicPosition) : array|string

Get the validated value

Parameters

integer $intDynamicPosition

Returns

array|string

getValue()

getValue(integer  $intDynamicPosition) : string|array|null

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

Parameters

integer $intDynamicPosition

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

Returns

string|array|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.

setRequired()

setRequired(boolean  $blnValue) 

Set required state

Parameters

boolean $blnValue

getRequired()

getRequired(boolean  $blnDefault = false) : boolean

Get required state

Parameters

boolean $blnDefault

Returns

boolean

validate()

validate(integer  $intDynamicPosition) : boolean

The most important function of ValidForm Builder library.

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

Parameters

integer $intDynamicPosition

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

Returns

boolean —

True if the current field validates, false if not.

sanitize()

sanitize(  $varValue, null|array  $arrSanitisers = null) : string

Sanitize a value according to preset rules.

Parameters

$varValue
null|array $arrSanitisers

Returns

string

preSanitize()

preSanitize(  $varValue, null|array  $arrSanitisers = null) : string

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

Parameters

$varValue
null|array $arrSanitisers

Returns

string

setError()

setError(string  $strError, integer  $intDynamicPosition) 

Set custom error on a field

Use this to set a custom error on a field

Parameters

string $strError

Custom error message

integer $intDynamicPosition

getError()

getError(integer  $intDynamicPosition) : string

Get error message

Parameters

integer $intDynamicPosition

Returns

string

getCheck()

getCheck() : string

Get the validation rule (regular expression)

Returns

string

getField()

getField() : \ValidFormBuilder\Base

Returns the value of $__field

Returns

\ValidFormBuilder\Base

setField()

setField(\Base  $value) : void

Overwrites the value of $__field

Parameters

\Base $value

getType()

getType() : integer

Returns the value of $__type

Returns

integer

setType()

setType(integer  $value) : void

Overwrites the value of $__type

Parameters

integer $value

getFieldName()

getFieldName() : string

Returns the value of $__fieldname

Returns

string

setFieldName()

setFieldName(string  $value) : void

Overwrites the value of $__fieldname

Parameters

string $value

getFieldHint()

getFieldHint() : string

Returns the value of $__fieldhint

Returns

string

setFieldHint()

setFieldHint(string  $value) : void

Overwrites the value of $__fieldhint

Parameters

string $value

getMinLength()

getMinLength() : integer

Returns the value of $__minlength

Returns

integer

setMinLength()

setMinLength(integer  $value) : void

Overwrites the value of $__minlength

Parameters

integer $value

getMaxLength()

getMaxLength() : integer

Returns the value of $__minlength

Returns

integer

setMaxLength()

setMaxLength(integer  $value) : void

Overwrites the value of $__minlength

Parameters

integer $value

getMatchWith()

getMatchWith() : \ValidFormBuilder\Element

Returns the value of $__matchwith

Returns

\ValidFormBuilder\Element

setMatchWith()

setMatchWith(\Element  $value) : void

Overwrites the value of $__matchwith

Parameters

\Element $value

getMaxFiles()

getMaxFiles() : integer

Returns the value of $__maxfiles

Returns

integer

setMaxFiles()

setMaxFiles(integer  $value) : void

Overwrites the value of $__maxfiles

Parameters

integer $value

getMaxSize()

getMaxSize() : integer

Returns the value of $__maxsize

Returns

integer

setMaxSize()

setMaxSize(integer  $value) : void

Overwrites the value of $__maxsize

Parameters

integer $value

getFileTypes()

getFileTypes() : array

Returns the value of $__filetypes

Returns

array

setFileTypes()

setFileTypes(array  $value) : void

Overwrites the value of $__filetypes

Parameters

array $value

getValidation()

getValidation() : string

Returns the value of $__validation

Returns

string

setValidation()

setValidation(string  $value) : void

Overwrites the value of $__validation

Parameters

string $value

getDefaultRequired()

getDefaultRequired() : boolean

Returns the value of $__defaultRequired

Returns

boolean

setDefaultRequired()

setDefaultRequired(boolean  $value) : void

Overwrites the value of $__defaultRequired

Parameters

boolean $value

getMinLengthError()

getMinLengthError() : string

Returns the value of $__minlengtherror

Returns

string

setMinLengthError()

setMinLengthError(string  $value) : void

Overwrites the value of $__minlengtherror

Parameters

string $value

getMaxLengthError()

getMaxLengthError() : string

Returns the value of $__maxlengtherror

Returns

string

setMaxLengthError()

setMaxLengthError(string  $value) : void

Overwrites the value of $__maxlengtherror

Parameters

string $value

getMatchWithError()

getMatchWithError() : string

Returns the value of $__matchwitherror

Returns

string

setMatchWithError()

setMatchWithError(string  $value) : void

Overwrites the value of $__matchwitherror

Parameters

string $value

getRequiredError()

getRequiredError() : string

Returns the value of $__requirederror

Returns

string

setRequiredError()

setRequiredError(string  $value) : void

Overwrites the value of $__requirederror

Parameters

string $value

getTypeError()

getTypeError() : string

Returns the value of $__typeerror

Returns

string

setTypeError()

setTypeError(string  $value) : void

Overwrites the value of $__typeerror

Parameters

string $value

getHintError()

getHintError() : string

Returns the value of $__hinterror

Returns

string

setHintError()

setHintError(string  $value) : void

Overwrites the value of $__hinterror

Parameters

string $value

getSanitisers()

getSanitisers() : array|null

Returns the value of $__sanitisers

Returns

array|null

setSanitisers()

setSanitisers(array  $value) : void

Overwrites the value of $__sanitisers

Parameters

array $value