core-jvm
core2-jvm (latest)core-jvm
  • Home
  • Features
  • Examples
  • Spec
  • Guides
  • Sandbox
  • Step Studio
  • Step
    • Action
    • Behavior
    • External
    • Help
    • Link Handler
    • Navigation
    • Persist Async
    • Polling
    • Refresh On Change
    • Step Error
    • Summary
    • Upload
    • Validate Async
    • Schema
    • All Of Schema
    • Array Schema
    • Blob Schema
    • Boolean Schema
    • Const Schema
    • Integer Schema
    • Number Schema
    • Object Schema
    • One Of Schema
    • String Schema
    • Layout
    • Alert Layout
    • Box Layout
    • Button Layout
    • Columns Layout
    • Decision Layout
    • Form Layout
    • Heading Layout
    • Image Layout
    • Instructions Layout
    • List Layout
    • Loading Indicator Layout
    • Markdown Layout
    • Modal Layout
    • Paragraph Layout
    • Review Layout
    • Search Layout
    • Status List Layout
    • Action Response Body
    • Error Response Body
    • Flow Response
    • Search Response Body
    • Search Result
    • Align
    • Autocapitalization Type
    • Autocomplete Token
    • Context
    • Icon
    • Image
    • Size
These docs refer to the older 1.x release of Dynamic Flow.
Go to the latest docs

Validate Async

Android - 8.25.0 iOS - 11539 Web - 2.5.0

Validation Async allows you to validate the value of a field on change by calling an endpoint.

This allows for more complex validation than is possible using local validation rules.

When the value of a schema with a Validate Async configuration changes, first any local validation is run. If this local validation passes, a request is sent to the URL defined at [url], where the request body is a JSON object containing the value of the field under a property matching the value of [param].

On success, the server should respond with a 2xx status code and either an empty body, in which case no feedback is given to the user, or a JSON body with a message property, which will be shown to the user. On failure, the server should respond with a 422 status code and a JSON body with a message property which will be shown to the user.

Note that "failed" validation does not prevent the client from submitting the step in the case of async validation.

Also, in the case where the validation-async network call fails or returns an unexpected response, the client ignores the problem and allows the user to submit.

For these reasons, any validation which is critical should also be performed by the server on submission.

Example

Given a schema defined as:

string {
    title = "IBAN"
    validationAsync = ValidateAsync(
        param = "iban",
        method = HttpMethod.POST,
        url = "/validate-iban"
    )
}

When the user enters a value, e.g. "NL30ABNA7619995846", a POST request would be made to the /validate-iban endpoint with the following body:

{
  "iban": "NL30ABNA7619995846"
}

On success, the server responds with a 200 status code and the response body should either be empty, in which case no feedback will be given to the user, or a JSON body with the following structure:

{
  "message": "Valid IBAN"
}

In which case the message will be displayed to the user to let them know the value they have entered is valid.

On failure, the server should respond with a 422 status code and a json body giving a message to display to the user:

{
  "message": "This IBAN is invalid. Please check it again."
}

Properties

PropertyTypeRequiredDescription
methodStringYesThe HTTP method to use for the request. Only methods which allow a request body are supported.
paramStringYesThe name of the property under which the value of the schema will be sent in the request body.
urlStringYesThe URL to use for the request.