Interface: AsyncValidator

Oracle® JavaScript Extension Toolkit (JET)
9.2.0

F30740-01

Signature:

interface AsyncValidator<V>

QuickNav

Fields

AsyncValidator

Version:
  • 9.2.0
Since:
  • 5.2.0
Module:
  • ojvalidator-async

Module usage

See JET Module Loading for an overview of module usage within JET.

Typescript Import Format
//To use this interface, import as below.
import AsyncValidator= require("ojs/ojvalidator-async");

//To access this interface in your code:
declare class MyAsyncValidator implements AsyncValidator
Generic Parameters
ParameterDescription
VType of value to be validated

JET In Typescript

A detailed description of working with JET elements and classes in your typescript project can be found at: JET Typescript Usage.

The AsyncValidator interface is a duck-typing interface for creating asynchronous validators that can be set on the EditableValue (aka JET form) components that have the async-validators attribute.

Fields

hint :Promise.<(string|null)>

hint is an optional attribute. It is a Promise that resolves to the hint string or null.

Methods

validate(value: V): Promise<void>

A method that validates the value. The function returns a Promise that resolves to void if the validation passes or a Promise that rejects with an error if it fails. The error will be shown on the component.

It is recommended that you show the value you are validating in the error message because if the async operation takes a while, the user could be typing in a new value when the error message comes back and might be confused what value the error is for.

If you need to format the value for the error message, you can use e.g. for number new NumberConverter.IntlNumberConverter(converterOption) to get the converter instance, then call converter.format(value);

Parameters:
Name Type Description
value any to be validated
Returns:
A Promise that resolves to nothing if validation passes or rejects with an Error if validation fails.
Type
Promise.<void>