/form/

A mobo Form describes all mobo models that the form consits of. For each mobo Form, a Semantic Form will be created.

Please note that mobo forms are much more lightweight than regular SF Forms, since most information has already been declared and inherited in mobo fields and mobo models.

Forms declare:

  • Which models to use
  • If the model should be implemented as a single or multiple instance template
  • Which template to use / inject
  • The order of these models and templates
  • Visibility of templates in edit-view and reading-view

Available Properties

ID Description
$abstract

If true this object is only used for inheritance and will not be created by itself.

Type(s): boolean

Specific to: intermediary

Default: false

Example:

$abstract: true
$extend

This includes and extends another file of the development.
Inheritance is applied, the children (the current file) overwrites the parent properties.

Type(s): arraystring

Specific to: intermediary

Example:

# Inherit a single parent
$extend: /model/_Shape

Example:

# Multiple parents are possible
$extend:
  - /field/fieldA
  - /field/fieldB

Example:

# extend is also used to import fields into models or models into forms.
title: A Model with two fields
items:
  - $extend: /field/fieldA
  - $extend: /field/fieldB
$ignore

If true, this file will be ignored completely.
Use this to temporarily remove parts of the development model without deleting them.

Type(s): boolean

Specific to: intermediary

Default: false

Example:

$ignore: true
$remove

Array, containing the IDs of all items/properties to remove from current object.

Type(s): array

Specific to: intermediary

Example:

$remove:
  - fieldA
  - fieldB
description

General Description. Fields may use them as tooltips, forms can display a small description box. This depends on the used template.

Type(s): string

Specific to: domain

Example:

description: |
  Longer description of the current model part.
items

Declares all models and templates that the form uses and imports them through `$extend`.
To create multiple instance templates, add another items hierachy (see example).

Type(s): arrayobject

Specific to: domain

Default: {}

Example:

items:
# Import a template and show it only in the page-view
- $extend: /smw_template/SomeTemplate
  showForm: false

# Include a single instance model
- $extend: /model/SingleInstanceModel

# Include a multiple instance model
- items:
    $extend: /model/MultipleInstanceModel
itemsOrder

In case that fields have been inherited, they might not end up in the correct order.
The itemsOrder array lists the order of the fields. Every field that is not listed will be appended at the bottom, in their regular order.

Type(s): array

Specific to: domain

Example:

itemsOrder:
  - brand
  - modelName

Example:

itemsOrder:
  - '@unique'
  - '@sorted'
  - b
  - c
  - a
  - b
naming

Provides naming conventions / guideline. Will appear on the form page itself.

Type(s): string

Specific to: domain

Example:

naming: 'lastname, firstname'
sf_forminfo

Object, containing all SemanticForms info parameters.

Type(s): object

Specific to: platform

Example:

sf_forminfo:
  create title: Create a new location
  edit title: Edit a location
sf_forminput

Object, containing SemanticForms #forminput options

Type(s): object

Specific to: platform

Example:

smw_forminput:
  autocomplete on category: SomeCategory
sf_freetext

Decides whether the freetext textarea will be displayed below the form.

Type(s): boolean

Specific to: platform

Default: true

Example:

sf_freetext: false
sf_summary

Decides whether the summary field will be displayed below the form.

Type(s): boolean

Specific to: platform

Default: false

Example:

sf_summary: false
title

Human readable title.

Type(s): string

Specific to: domain

Example:

title: Some title
todo

If TODO notes are placed here, mobo can print them in the CLI (If the corresponding global setting is enabled).

Type(s): string

Specific to: domain

type

Defines the data-type.

Type(s): string

Specific to: domain

Valid entries: string, number, boolean, array, object

Example:

type: number

Important Concepts

items

The items property contains an array of all models and templates that are used by the form. Models are imported using $extend.

To define a model as a multiple instance template, use type: array and define it as items

items:
  - $extend: /model/Location
  - $extend: /smw_template/NetworkPrinterHeader
    showForm: true # True by default, can be ommited
    showPage: true # True by default, can be ommited
  - type: array
    items:
      $extend: /model/NetworkPrinterInstallation
  - $extend: /smw_template/NetworkScannerHeader

Including Templates

If you want to include templates into the form, you can do so by using $extend to an smw_template.

- $extend: /smw_template/NetworkPrinterHeader
    showForm: true # True by default, can be ommited
    showPage: true # True by default, can be ommited

There are two options, both true by default:

  • showForm decides if the template is rendered while displaying the form in edit mode
  • showSite decides if the template should be rendered when displaying the site. (Notice: The Site has to be (re)saved through the form to make this work)

This is useful for introducion headers into a form / resulting site. If you use the HeaderTabs Extension you are required to use this.