Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents
minLevel1
maxLevel3
outlinefalse
typelist
printablefalse

What is the Form Config?

The Form Config is the central configuration file of a form. It defines things like:

...

All form configs inside the form folder will be automatically picked-up and shown in the forms overview of an app. For example, here you can see the form Add person automatically listed:

...

Configuration Attributes

The form config contains different attributes in order to specify the form. All of these attributes are described in detail below.

title

The title defines the title of the form to be displayed in the web ui and in other locations.

This can be a static text or an i18n uri like $uri:i18n:myTitle for example.

description

The description is optional and describes the intention of the form.

This can be a static text or an i18n uri like $uri:i18n:myDescription for example.

icon

Each form can have an individual icon. This value must be a code name from the Google Material Icons as listed here: https://fonts.google.com/icons

This value is optional. If not given, the icon with code name ballot is shown as default:

...

color

The color of the form icon. If not given, the secondary color is used, which depends on the style settings. By default this is a blue color like this:

...

Another example:

"color": "red-8"

...

schema

The schema attribute defines a PIPEFORCE URI which is called in order to retrieve the Form schema for this form.

...

Code Block
languagejson
{
  "type": "object",
  "properties": {
    "firstName": {
      "type": "string",
      "title": "First Name",
      "description": "The first name of the person."
    },
    "lastName": {
      "type": "string",
      "title": "Last Name",
      "description": "The last name of the person."
    },
    "age": {
      "type": "number",      
      "title": "Age",
      "description": "The age of the person."
    },
    "gender": {
      "type": "string",
      "title": "Gender",
      "description": "The gender of the person.",
      "enum": [
        "male",
        "female",
        "neutral"
      ]
    },
    "birthDate": {
      "type": "string",
      "format": "date",
      "title": "Date of birth",
      "description": "The date of birth of the person."
    }
  }
}

output

The output defines the path in the property store where the form data must be stored as JSON property after the form has been submitted. Example:

...

input

The input attribute defines a PIPEFORCE URI which is called to retrieve the initial input data for the form in order to set predefined values on the form widgets. For example, the input parameter could look like this in order to load a JSON property from the property store:

...

Code Block
languagejson
{
  "firstName": "Alice",
  "lastName": "Smith",
  "age": 20,
  "gender": "female",
  "birthDate": "2003/05/01"
}

forwardOnSuccess

Status
colourRed
titleDeprecated
Use onSuccess instead.

This attribute defines an URL, or a path relative to the portal in order to forward to after the form has been submitted successfully. In case the submit caused an error, the form will stay at current location in order to display the error. In case this attribute is not given, the form will show the default submit success message.

onSuccess

Status
colourBlue
titleSince 9.0

This defines what should happen in case the form was successfully submitted. This is optional. If not defined, the default success message and icon will be shown:

forward

Forwards to a URL or a path relative to the portal. In case the submit caused an error, the form will stay at current location in order to display the error:

...

  • action - must be set to forward.

  • url - The URL or the path relative to the portal where to forward after success.

message

Shows a text message and an icon in case the form was successfully submitted.

...

  • action - Must be set to message.

  • text - Can contain a static text or an i18n key. If not given, the default text will be shown.
    See: TODO

  • icon - Must be a code name from the Google Material Icon. If not given, the default icon will be shown. See: https://fonts.google.com/icons .

  • color - Defines the color of the icon. If not given, the default icon color will be shown.
    See Colors .

layout

By default, in a form, all widgets (= fields) of the Form Schema are displayed vertically, each ints own row.

...

Vertical orientation

You can change this default by configuring orientation of the layout in the Form Config.

...

This example layout configuration would create exactly the default layout again:

...

Horizontal orientation

You can then change the orientation, width and height of a layout item like this:

...

Both min-width and max-width can be also used in place of width to reach responsiveness within defined limits.

Nesting layouts and orientations

Layouts and its orientations can be nested in order to create quite complex form structures. Here’s an example:

...

This example would produce a form like this with nested orientation:

...

field

Inside a layout element you can place field elements pointing to field ids (widgets). This element can contain additional attributes like these:

hidden

If set to true, the widget is not shown in the form, but the value from the input is sent to the backend on submit. Example:

Code Block
languagejson
      ...
      {
        "orientation": "vertical",
        "items": [
          {"field": "age", "hidden": true}
        ]
      },
      ...

readonly

If set to true, the widget value cannot be changed. Example:

Code Block
languagejson
      ...
      {
        "orientation": "vertical",
        "items": [
          {"field": "age", "readonly": true}
        ]
      },
      ...

type

TODO

Internationalization (i18n)

TODO

Special Form Types

Document Understand Form

TODO

Variable substitution

Request parameters

It is possible to use request parameters in the form config attributes as placeholders like this:

...

These attributes in the form config support request parameter variable substitution:

  • input

  • output

  • schema

Property attributes (PEL)

It is also possible to specify a PEL inside some of the config attributes. This way the PEL will be executed at server side and the result will be used to form the final config value. For example:

...