Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The JSON format of the output is the same as the format of the input model and must comply with the Form Schema.

The Form Schema (Model)

For more details go to: The Form Schema

The Form Schema document describes the fields structure of a Form Model using the JSON Schema specification. For example the type of the field, validation rules, the title and so on.

It belongs to the “model” part of the MVC form framework.For more details go to: /wiki/spaces/DEV/pages/2482176001

Here is an example of such a Form Schema JSON:

Code Block
languagejson
{
  "type": "object",
  "properties": {
    "firstName": {
      "type": "string",
      "description": "Add our first name here",
      "minLength": 2
    },
    "lastName": {
      "type": "string"
    },
    "age": {
      "type": "integer"
    },
    "cv": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        },
        "contentLength": {
          "type": "number"
        },
        "contentType": {
          "type": "string"
        },
        "contentEncoding": {
          "type": "string"
        },
        "content": {
          "type": "string"
        }
      }
    }
  },
  "required": [
    "firstName",
    "lastName",
    "age"
  ]
}

The Form Config (View)

For more details go to: /wiki/spaces/DEV/pages/2482798727

The Form Config is the central configuration file of a form.

...

  • How the fields of a form must be positioned in the view (= the layout).

  • Where to load and write the form model from / to.

  • Where to load the schema of the form from.

  • What to do, after a form has been submitted.

  • Title, description, type and other settings of the form.

For more details go to: /wiki/spaces/DEV/pages/2482798727

Here is an example of such a Form Config:

...

The Pipeline (Controller)

For more details, see:

After the form has been submitted by the user, the output data will be stored in the property store and then a property.created event will be fired by the property store.

...

The pipeline belongs to the “controller” part of the MVC form framework.For more details, see:

Here is an example of such a pipeline listening to the event:

Code Block
languageyaml
pipeline:
  - event.listen:
      keyeventKey: property.created
      filter: ${body.target.path.contains('global/app/myapp/object/person/v1/instance')}
  
  - mail.send:
    to: name@email.tld
    subject: "Apllication form was submitted"
    messsage: |
      The application form was submitted:
      ${body.target}

The pipeline listens to all property.created events and in case a property was created which matches the given filter, it will be executed and can then further process the form output data which are provided in the body.

...