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