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,
        ...
    }
}

The type Property

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
  • overlap
  • padlock
  • popup
  • text
  • image

The version Property

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.

The key Property

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

The tags Property

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.

The validator Property

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.

The validation_error Property

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 ""