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 \Prado\Web\UI\WebControls\setMinValue and \Prado\Web\UI\WebControls\setMaxValue properties specify the minimum and maximum values of the valid range. The \Prado\Web\UI\WebControls\setDataType 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 \Prado\Web\UI\WebControls\setDateFormat property, which must be recognizable by TSimpleDateFormatter. If the property is not set, the GNU date syntax is assumed.
- String A string data type.
- StringLength check for string length.
If \Prado\Web\UI\WebControls\setStrictComparison 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 \Prado\Web\UI\WebControls\setCharset property can be used to force a particular charset for comparison. Otherwise, the application charset is used and is defaulted as UTF-8.
Class hierarchy
- \Prado\Web\UI\WebControls\TRangeValidator
- \Prado\Web\UI\WebControls\TBaseValidator implements IValidator
- \Prado\Web\UI\WebControls\TLabel implements IDataRenderer
- \Prado\Web\UI\WebControls\TWebControl implements IStyleable
- \Prado\Web\UI\TControl implements IRenderable, IBindable
- \Prado\TApplicationComponent
- \Prado\TComponent
Since: 3.0
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
setDataType(TRangeValidationDataType $value) : mixed
Sets the data type that the values being compared are converted to before the comparison is made.
|
public
|
|
public
|
|
public
|
|
public
|
|
protected
|
evaluateIsValid() : bool
This method overrides the parent's implementation.
The validation succeeds if the input data is within the range. The validation always succeeds if the input data is empty. |
protected
|
getClientClassName() : string
Gets the name of the javascript class responsible for performing validation for this control.
This method overrides the parent implementation. |
protected
|
getClientScriptOptions() : array<string|int, mixed>
Returns an array of javascript validator options.
|
protected
|
|
protected
|
|
protected
|
isValidDate(string $value) : bool
Determine if the date is within the specified range.
Uses pradoParseDate and strtotime to get the date from string. |
protected
|
|
protected
|
|
protected
|
isValidString(string $value) : bool
Compare the string with a minimum and a maxiumum value.
Uses strcmp for comparision. |
protected
|