Class: NumberRangeValidator

Oracle® Fusion Middleware Oracle JavaScript Extension Toolkit (JET)
12c (12.1.4)

E54107-01

QuickNav

oj. NumberRangeValidator

Constructor

new NumberRangeValidator(options)

Constructs a NumberRangeValidator that ensures the value provided is within a given range
Parameters:
Name Type Argument Description
options Object <optional>
an object literal used to provide:

  • min: The minimum number value of the entered value.
  • max: The maximum number value of the entered value.
  • hint: optional object literal of hint text to be used.
    • 'hintMaximum': Hint message to be used, to indicate the allowed maximum.

      Parameters:

      • {max} the maximum
      Usage: Enter a number less than or equal to {max}
    • 'hintMinimum': Hint message to be used, to indicate the allowed minimum.

      Parameters:

      • {min} the minimum
      Usage: Enter a number greater than or equal to {min}
    • 'hintInRange': Hint message to be used, to indicate the allowed range.

      Parameters:

      • {min} the minimum
      • {max} the maximum
      Usage: Enter a number between {min} and {max}
  • message: optional object literal of custom error message to be used:

    • 'messageMaximum': The detail error message to be used as the error message, when input value exceeds the maximum value set.

      Parameters:

      • {value} value entered by the user
      • {max} the maximum allowed value
      Usage: The number {value} must be less than or equal to {max}.
    • '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 number {value} must be greater than or equal to {min}.
    • '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 {value} is not between {min} and {max}.
Source:

Methods

getHint() → {String|null}

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 Argument Description
options Object <optional>
Source:

validate(value) → {string}

Validates the minimum + maximum conditions
Parameters:
Name Type Description
value string | number that is being validated
Source:
Throws:
when value is out of range
Type
Error
Returns:
original if validation was successful
Type
string