PHP Class 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.
Mostrar archivo
Open project: pradosoft/prado
Class Usage Examples
Public Methods
Protected Methods
Method Details
evaluateIsValid()
protected method
The validation succeeds if the input data is within the range.
The validation always succeeds if the input data is empty.
getCharset()
public method
getClientClassName()
protected method
This method overrides the parent implementation.
getClientScriptOptions()
protected method
Returns an array of javascript validator options.
getDataType()
public method
public getDataType ( ) : TRangeValidationDataType |
return |
TRangeValidationDataType |
the data type that the values being compared are
converted to before the comparison is made. Defaults to TRangeValidationDataType::String. |
getMaxValue()
public method
getMinValue()
public method
getStrictComparison()
public method
isGreaterThan()
protected method
isLessThan()
protected method
isValidDate()
protected method
Uses pradoParseDate and strtotime to get the date from string.
isValidFloat()
protected method
Determine if the value is within the specified float range.
isValidInteger()
protected method
Determine if the value is within the integer range.
isValidString()
protected method
Uses strcmp for comparision.
isValidStringLength()
protected method
setCharset()
public method
setDataType()
public method
Sets the data type that the values being compared are converted to before the comparison is made.
setMaxValue()
public method
Sets the maximum value of the validation range.
setMinValue()
public method
Sets the minimum value of the validation range.
setStrictComparison()
public method