Form Description Language

In upcoming versions the Form Description Language is planned to undergo major improvements.

For each Domain Entity defined in the previous chapter you can define how the input is gathered from the user for each particular entity.

The form description file is then linked to in the main domain definition file under options by setting a relative path to your form description file to the form key.

As an example here is a form definition for the Mug defined in the previous chapter:

Mug:
    - parallel:
        - meta:
            title: Size of mug
        - input:
            field: height
            title: Mug Height
        - input:
            field: diameter
            title: Mug Diameter

    - parallel:
        - meta:
            title: Styling choices
        - input:
            field: has_handle
            title: Has Handle
        - input:
            field: label
            title: Text to print
        - input:
            field: color
            title: Color

On the root level of this file Konfoo expects keys with the same names as the Domain Entities the form logic would be be used for. So for Mug we define Mug here as well.

Everything underneath the Domain Entity name should be list of Nodes.

Nodes

In the example above several different types of nodes are used:

  • - parallel
    • A group node that signals Konfoo to ask input for all sub-nodes in one step
    • Expects a list of sub-nodes under it
  • - input
    • An input node maps a field in the Domain Entity to a form control
    • Input nodes cannot have sub-nodes
    • field: - field name in the Domain Entity
    • title: - the label to display to the user
  • - meta
    • This provides metadata to any parent node
    • Meta nodes expect key-value pairs under it
    • title key is used as a user-friendly label for the particular parent node

For in-depth description see Types of Nodes. To understand how the web client builds the resulting forms see Traversal Strategies.