Class: LengthValidator
Oracle® Fusion Middleware Oracle JavaScript Extension Toolkit (JET)
12c (12.1.4)
E54107-01
Constructor
new LengthValidator(options)
Constructs a LengthValidator that ensures the value entered is within a given length.
Parameters:
Name |
Type |
Argument |
Description |
options |
Object
|
<optional>
|
an object literal used to provide:
- min: A number that is the minimum length of the value.
- max: a number that is the maximum length of the value.
- hint: optional object literal of hint text to be used. There is no default
hint provided by this validator.
- 'hintMaximum': Hint message to be used, to indicate the allowed maximum.
Parameters:
Usage: Enter {max} or fewer characters
- 'hintMinimum': Hint message to be used, to indicate the allowed minimum.
Parameters:
Usage: Enter {min} or more characters
- 'hintInRange': Hint message to be used, to indicate the allowed range.
Parameters:
- {min} the minimum
- {max} the maximum
Usage: Enter between {min} and {max} characters
- message: optional object literal of custom error message to be used:
- 'messageMaximum': The detail error message to be used as the error message, when
the length of the input value exceeds the maximum value set.
Parameters:
- {value} value entered by the user
- {max} the maximum allowed value
Usage: The {value} has too many characters. Enter {max} or fewer characters, not more.
- 'messageMinimum': The detail error message to be used as the error message, when
input value is less than the set minimum value.
Parameters:
- {value} value entered by the user
- {min} the minimum allowed value
Usage: The {value} has too few characters. Enter {min} or more characters, not less.
- 'messageNotInRange': The detail error message to be used as the error messages, when
input value is not with in the range, set by min and max options.
Parameters:
- {value} value entered by the user
- {min} the minimum allowed value
- {max} the maximum allowed value
Usage: The number of characters in {value} is out of range. Enter {min} or more characters
up to a maximum of {max}.
|
- Source:
Methods
-
Init(options)
-
Initializes validator instance with the set options
Parameters:
Name |
Type |
Argument |
Description |
options |
Object
|
<optional>
|
|
- Source:
-
validate(value) → {string}
-
Validates the length of vaue is greater than minimum and/or less than maximum.
Parameters:
Name |
Type |
Description |
value |
string
|
that is being validated |
- Source:
Throws:
when the length is out of range.
-
Type
-
Error
Returns:
original if validation was successful
-
Type
-
string