Class: RegExpValidator
Oracle® Fusion Middleware Oracle JavaScript Extension Toolkit (JET)
12c (12.1.4)
E54107-01
Constructor
new RegExpValidator(options)
Constructs a RegExpValidator that ensures the value matches the provided pattern
Parameters:
| Name |
Type |
Description |
options |
Object
|
an object literal used to provide the pattern, an optional hint and error
message.
- pattern: a regexp pattern that the validator matches a value against.
Example:
'\\d{10}'
- hint: an optional hint text. There is no default hint provided by the validator.
Parameters:
{pattern} - the pattern to enforce
Example:
"value must meet this pattern {pattern}"
-
messageSummary: a custom error message summarizing the error
Parameters:
{label} - label of the component for which this message applies. The label may not always be
available depending on the usage of the validator.
{pattern} - the pattern the value should match
{value} - value entered by user
Examples:
"'{label}' Format Incorrect" // translating to 'Phone Number' Format Incorrect
- messageDetail: a custom error message to be used for creating detail part of message, when
the users input does not match the specified pattern.
Parameters:
{label} - label text of the component for which this message applies.
{pattern} the 'pattern' that the value should match
{value} value entered by the user
Examples:
"The value {value} must contain at least 3 alphanumeric characters"
|
- Source:
Methods
-
getHint() → {String|null}
-
A message to be used as hint, when giving a hint on the expected pattern. There is no default
hint for this property.
- Source:
Returns:
a hint message or null if no hint is available in the options
-
Type
-
String
|
null
-
Init(options)
-
Initializes validator instance with the set options
Parameters:
| Name |
Type |
Description |
options |
Object
|
|
- Source:
-
validate(value) → {boolean}
-
Validates value for matches using the regular expression provided by the pattern.
Parameters:
| Name |
Type |
Description |
value |
string
|
number
|
that is being validated |
- Source:
Throws:
when there is no match
-
Type
-
Error
Returns:
true if validation was successful
-
Type
-
boolean