Shared Properties between all Form Elements

This article describes the common characteristics among all XS2A Form API elements. They share the following structure:

{
    "type": Enum,
    "version": String,
    "key": ?String,
    "tags": Array<String>,
    "validator": ?Validator,
    "validation_error": ?{
        <validation.rule>: Boolean,
        <validation.rule>: Boolean,
        ...
    }
}

type Enum, always present

The type property of the form element is the most important property and defines the type of the element. The following types are allowed:

  • context
  • input
  • choice
  • toggle
  • switchable
  • flicker
  • padlock
  • text
  • link
  • image

version String, always present

The version property follows the semantic versioning specification and defines the interoperability for the XS2A Form API client. The XS2A Form API client should check this version and abort if the version of an element is unsupported (for example for major-changes). The version property might differ between elements of the same type.

key String, optional

The key property is only used in elements which can be returned to the XS2A Form API with a corresponding value. Elements which do not change on the client side do not have a key property.

Form elements that have a key property are of the type:

  • input
  • choice
  • toggle
  • switchable
  • padlock

tags String[], always present

The tags array containes uppercase strings. It is recommend to treat tags as layout- and styling-suggestions. The tags array is ordered with regard to priority, meaning that the first element in the array is more important than the last, and should be used if the two do not match.

validator Validator, optional

The validator property defines information to validate the form elements value before sending it to the API. Detailed information on how to use the validator property can be found on the respective pages of the applicable XS2A Form elements.

validation_error Object, optional

Detailed information on how to interpret the validation_error property can be found on the page for Server-side Validation.

results matching ""

    No results matching ""