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.
Показать файл
Открыть проект
Примеры использования класса
Открытые методы
Защищенные методы
Описание методов
evaluateIsValid()
защищенный Метод
The validation succeeds if the input data is within the range.
The validation always succeeds if the input data is empty.
getCharset()
публичный Метод
getClientClassName()
защищенный Метод
This method overrides the parent implementation.
getClientScriptOptions()
защищенный Метод
Returns an array of 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. |
getMaxValue()
публичный Метод
getMinValue()
публичный Метод
getStrictComparison()
публичный Метод
isGreaterThan()
защищенный Метод
isLessThan()
защищенный Метод
isValidDate()
защищенный Метод
Uses pradoParseDate and strtotime to get the date from string.
isValidFloat()
защищенный Метод
Determine if the value is within the specified float range.
isValidInteger()
защищенный Метод
Determine if the value is within the integer range.
isValidString()
защищенный Метод
Uses strcmp for comparision.
isValidStringLength()
защищенный Метод
setCharset()
публичный Метод
setDataType()
публичный Метод
Sets the data type that the values being compared are converted to before the comparison is made.
setMaxValue()
публичный Метод
Sets the maximum value of the validation range.
setMinValue()
публичный Метод
Sets the minimum value of the validation range.
setStrictComparison()
публичный Метод