PHP Класс Prado\Web\UI\WebControls\TRangeValidator

TRangeValidator tests whether an input value is within a specified range. TRangeValidator uses three key properties to perform its validation. The {@link setMinValue MinValue} and {@link setMaxValue MaxValue} properties specify the minimum and maximum values of the valid range. The {@link setDataType DataType} property is used to specify the data type of the value and the minimum and maximum range values. These values are converted to this data type before the validation operation is performed. The following value types are supported: - Integer A 32-bit signed integer data type. - Float A double-precision floating point number data type. - Date A date data type. The date format can be specified by setting {@link setDateFormat DateFormat} property, which must be recognizable by {@link TSimpleDateFormatter}. If the property is not set, the GNU date syntax is assumed. - String A string data type. - StringLength check for string length. If {@link setStrictComparison StrictComparison} is true, then the ranges are compared as strictly less than the max value and/or strictly greater than the min value. The TRangeValidator allows a special DataType "StringLength" that can be used to verify minimum and maximum string length. The {@link setCharset Charset} property can be used to force a particular charset for comparison. Otherwise, the application charset is used and is defaulted as UTF-8.
С версии: 3.0
Автор: Qiang Xue ([email protected])
Наследование: extends TBaseValidator
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
getCharset ( ) : string
getDataType ( ) : TRangeValidationDataType
getDateFormat ( ) : string
getMaxValue ( ) : string
getMinValue ( ) : string
getStrictComparison ( ) : boolean
setCharset ( $value )
setDataType ( $value ) Sets the data type that the values being compared are converted to before the comparison is made.
setDateFormat ( $value ) Sets the date format for a date validation
setMaxValue ( $value ) Sets the maximum value of the validation range.
setMinValue ( $value ) Sets the minimum value of the validation range.
setStrictComparison ( $value )

Защищенные методы

Метод Описание
evaluateIsValid ( ) : boolean This method overrides the parent's implementation.
getClientClassName ( ) : string Gets the name of the javascript class responsible for performing validation for this control.
getClientScriptOptions ( ) : array Returns an array of javascript validator options.
isGreaterThan ( $left, $right )
isLessThan ( $left, $right )
isValidDate ( $value ) : boolean Determine if the date is within the specified range.
isValidFloat ( $value ) : boolean Determine if the value is within the specified float range.
isValidInteger ( $value ) : boolean Determine if the value is within the integer range.
isValidString ( $value ) : boolean Compare the string with a minimum and a maxiumum value.
isValidStringLength ( $value ) : boolean

Описание методов

evaluateIsValid() защищенный Метод

The validation succeeds if the input data is within the range. The validation always succeeds if the input data is empty.
protected evaluateIsValid ( ) : boolean
Результат boolean whether the validation succeeds

getCharset() публичный Метод

public getCharset ( ) : string
Результат string charset for string length comparison.

getClientClassName() защищенный Метод

This method overrides the parent implementation.
protected getClientClassName ( ) : string
Результат string the javascript class name

getClientScriptOptions() защищенный Метод

Returns an array of javascript validator options.
protected getClientScriptOptions ( ) : array
Результат array javascript validator options.

getDataType() публичный Метод

public getDataType ( ) : TRangeValidationDataType
Результат TRangeValidationDataType the data type that the values being compared are converted to before the comparison is made. Defaults to TRangeValidationDataType::String.

getDateFormat() публичный Метод

public getDateFormat ( ) : string
Результат string the date validation date format if any

getMaxValue() публичный Метод

public getMaxValue ( ) : string
Результат string the maximum value of the validation range.

getMinValue() публичный Метод

public getMinValue ( ) : string
Результат string the minimum value of the validation range.

getStrictComparison() публичный Метод

public getStrictComparison ( ) : boolean
Результат boolean true to perform strict comparison.

isGreaterThan() защищенный Метод

protected isGreaterThan ( $left, $right )

isLessThan() защищенный Метод

protected isLessThan ( $left, $right )

isValidDate() защищенный Метод

Uses pradoParseDate and strtotime to get the date from string.
protected isValidDate ( $value ) : boolean
Результат boolean true if within range.

isValidFloat() защищенный Метод

Determine if the value is within the specified float range.
protected isValidFloat ( $value ) : boolean
Результат boolean true if within range.

isValidInteger() защищенный Метод

Determine if the value is within the integer range.
protected isValidInteger ( $value ) : boolean
Результат boolean true if within integer range.

isValidString() защищенный Метод

Uses strcmp for comparision.
protected isValidString ( $value ) : boolean
Результат boolean true if the string is within range.

isValidStringLength() защищенный Метод

protected isValidStringLength ( $value ) : boolean
Результат boolean true if min and max string length are satisfied.

setCharset() публичный Метод

public setCharset ( $value )

setDataType() публичный Метод

Sets the data type that the values being compared are converted to before the comparison is made.
public setDataType ( $value )

setDateFormat() публичный Метод

Sets the date format for a date validation
public setDateFormat ( $value )

setMaxValue() публичный Метод

Sets the maximum value of the validation range.
public setMaxValue ( $value )

setMinValue() публичный Метод

Sets the minimum value of the validation range.
public setMinValue ( $value )

setStrictComparison() публичный Метод

public setStrictComparison ( $value )