Class \Prado\Web\UI\WebControls\TRegularExpressionValidator
TRegularExpressionValidator class
TRegularExpressionValidator validates whether the value of an associated input component matches the pattern specified by a regular expression.
You can specify the regular expression by setting the \Prado\Web\UI\WebControls\setRegularExpression property. Some commonly used regular expressions include:
French Phone Number: (0( \d|\d ))?\d\d \d\d(\d \d| \d\d )\d\d French Postal Code: \d{5} German Phone Number: ((\(0\d\d\) |(\(0\d{3}\) )?\d )?\d\d \d\d \d\d|\(0\d{4}\) \d \d\d-\d\d?) German Postal Code: (D-)?\d{5} Email Address: \w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)* Japanese Phone Number: (0\d{1,4}-|\(0\d{1,4}\) ?)?\d{1,4}-\d{4} Japanese Postal Code: \d{3}(-(\d{4}|\d{2}))? P.R.C. Phone Number: (\(\d{3}\)|\d{3}-)?\d{8} P.R.C. Postal Code: \d{6} P.R.C. Social Security Number: \d{18}|\d{15} U.S. Phone Number: ((\(\d{3}\) ?)|(\d{3}-))?\d{3}-\d{4} U.S. ZIP Code: \d{5}(-\d{4})? U.S. Social Security Number: \d{3}-\d{2}-\d{4}
Note, the validation succeeds if the associated input control contains empty input. Use a TRequiredFieldValidator to ensure the input is not empty.
Class hierarchy
- \Prado\Web\UI\WebControls\TRegularExpressionValidator
- \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
|
evaluateIsValid() : bool
This method overrides the parent's implementation.
The validation succeeds if the input data matches the regular expression. The validation always succeeds if ControlToValidate is not specified or the regular expression is empty, or the input data is empty. |
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
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.
|