Parsware
All articles

Model-driven apps

Forms that fit the job

A form is tabs, rows and sections, with a header that stays put whichever tab is open. Lay one out in the Form Designer, give a table a second form for a different team, and let people switch between them on the record.

An asset record in dark mode with General and Assignment sections side by side and Owner and State in the header, next to the title "Forms that fit the job"

A new table comes with one form, and it's a long single column. That's fine for five fields. Past that, people scroll past what they don't need to find what they do, and two teams using the same records want to see different things.

We'll lay out the form of the Asset table from Build your first table and view, then give it a second form for the people who buy the equipment. Every picture is the real product.

Tabs, rows and sections

Open the table, choose Forms, and select the form to open the Form Designer. A form is built from three things:

  • Tabs across the top. Each tab is a page of the form.
  • Rows in a tab. A row has one to four columns: select it and set Columns.
  • Sections in a row, each holding fields. Add section puts another one beside the first.

Drag fields from Available fields on the left into a section, and drag them again to reorder them. Here the General tab has a two-column row: General on the left with the name and serial number, Assignment on the right with who has the asset and whether it's in service.

The Form Designer for the Asset Information form: Owner and State in the header, General and Purchase tabs, and a two-column row holding a General section (Name, Serial Number) and an Assignment section (Assigned To, In Service)

Add tab adds a Purchase tab, with a Purchase details section for the date and the cost. A section can also be wider than its neighbours: set its Width to the number of the row's columns it should take.

The Purchase tab in the designer: a Purchase details section holding Purchase Date and Purchase Cost, with its properties (Title, Icon, Width) on the right

A header that stays put

Above the tabs is the Header. Drop up to four fields there: the facts somebody needs before choosing a tab, such as who owns the record, what state it is in, or what it adds up to. Header fields are read-only unless you say otherwise, because the same field is usually on a tab as well.

Save, and open an asset in the app:

The ThinkPad X1 Carbon asset in the Asset Tracker app: Owner Platform Administrator and State Active in the header, General and Purchase tabs, and General and Assignment sections side by side

The owner and the state stay beside the name whichever tab is open.

A second form for a different job

The people who buy equipment don't care who has a laptop. They care what it cost. Rather than adding everything to one form, give them their own: on the table's Forms, press New and build a Purchasing form with the name, the serial number and the cost fields.

A table can have as many forms as it has jobs. One of them is the default, the one a record opens on. On the record, the form's name under the title switches between them:

The form switcher open under the record's title, offering Information (ticked) and Purchasing

The form as a document

What the designer saves is a document in a fixed shape: a header, then tabs, each tab a list of rows, each row a number of columns and the sections in them. The asset form after the steps above:

{
  "logicalName": "con_asset_information",
  "displayName": "Information",
  "entity": "con_asset",
  "formType": "Main",
  "description": "A piece of equipment: who has it, where it is and what it cost.",
  "header": [
    { "field": "owner_id" },
    { "field": "state" }
  ],
  "tabs": [
    {
      "title": "General",
      "rows": [
        {
          "columns": 2,
          "sections": [
            { "title": "General", "fields": [{ "field": "con_name" }, { "field": "con_serialnumber" }] },
            { "title": "Assignment", "fields": [{ "field": "con_assignedto" }, { "field": "con_inservice" }] }
          ]
        }
      ]
    },
    {
      "title": "Purchase",
      "rows": [
        {
          "columns": 2,
          "sections": [
            { "title": "Purchase details", "span": 2,
              "fields": [{ "field": "con_purchasedate" }, { "field": "con_purchasecost" }] }
          ]
        }
      ]
    }
  ]
}

A few things are easier to see here than in the designer. The header is a plain list of fields, read in order. "columns": 2 belongs to the row, and "span": 2 to the section that takes both columns. Each field is only a name, because it takes its label, its control and whether it is required from the field itself, unless the placement says otherwise. Required, read-only and default controls explains what a placement can override.

A layout that reads like a page

A good form answers the questions people bring to it in the order they bring them. A few rules of thumb hold for most tables:

  • Two columns for most sections. A long single column makes people scroll past fields they don't need. Two columns put twice as much in view and still read top to bottom.
  • Most-used tab first. The first tab is the one every record opens on. Put the fields people change every day there and the rarely touched ones on later tabs.
  • Group by question, not by type. Assignment holds who has the asset and whether it's in use, because those are answered together. A section called Dates that holds every date on the record is grouping by type, and nobody thinks that way.
  • State, Reason and Owner in the header. Every table has them, and they answer the first three questions about any record: where is it in its life, why, and whose is it? In the header they stay in view on every tab. States and reasons covers the first two, and Change who owns a record the third.
  • Short section titles. Assignment beats Information about who the asset is assigned to.
  • A one-line description. The form's description is shown on every record, so make it say what the record is, in about eighty characters, not how to use the form.

The form's description

The description you give a form appears under the record's title, on every record that opens with it. It is a sentence for the person who has just opened a record and wonders what it is, such as A piece of equipment: who has it, where it is and what it cost. Instructions belong somewhere longer, such as a guide in the side pane or the help pages. Keep it under 120 characters, so it fits on one line on most screens.

Notes on the form itself

When a section needs a word of explanation, a label sits among the fields and says it: Fill in the cost from the supplier's invoice, not the quote. Labels are text, not fields, so they store nothing. Notes and labels on a form shows how to add one.

Quick create: a small form for adding fast

Besides main forms, a table can have a quick create form: a short form with only the fields needed to add a record quickly. It is what a dashboard tile shows, so somebody can add a record beside the list it lands in without leaving the page. Keep it to the required fields and the ones nearly everybody fills in, and leave the rest for the main form. It is the same record either way: the same fields, the same required rules and the same server rules run whichever form saved it.

When to make a second form

A second form is worth it when a different group of people asks different questions of the same record. A few signs:

  • One team never uses half the fields, and another uses only that half. Purchasing and IT, over the same assets.
  • The same field must be read-only for one group and editable for another. The price set by finance, shown to everybody but changed only on finance's form.
  • A process needs a form of its own for one step, showing only what the person deciding needs to see. Coforms: a form for a task builds one.

Don't make a second form only to hide fields from people who mustn't see them. A form decides what is shown, not what is allowed. If somebody must not read the cost, take Read on that data away in their role, as Security roles in practice describes.

Which forms an app offers

An app decides which of a table's forms its people get. In the app, the table's Forms and views button opens this:

The Forms and views for Asset dialog: Forms set to Every form of this table, including ones added later, with Only the ones selected below as the alternative, and the same choice for Views

Leave it on every form and a form added later appears in the app too. Choose specific ones and the app keeps offering exactly those. So the finance team's app can offer Purchasing and the IT team's app Information, over the same records.

Questions that come up

What happens to a form if I delete a field it shows? A form is checked against the table every time it is saved, and every field it places has to exist. So take the field off the form, and save, before or after deleting it; the form won't save while it still names a field the table no longer has.

Can two forms share a tab? No. Each form is its own document. If several forms need the same section, that is usually a sign they are one form for one job, with a header and tabs that suit everybody.

Do changes to a form affect records? No. A form is how records are shown and edited; the records themselves are in the table. Rearrange a form as often as you like, and every record opens in the new layout the next time.

Which form opens from a lookup or a related tab? The table's default form, unless the app offers only certain forms, in which case the first of those. People can switch with the form switcher under the title if the app offers more than one.

Can a form hold a list of related records? Yes: every saved record has a Related menu after its tabs, listing the tables that point at it. Lookups shows it. A customer timeline gathers activities from several tables into one list on the form.

What's saved

A form is saved as a document and checked against the form schema, so every field it places has to exist on the table. It belongs to your solution and moves with it to Test and Production.

Next: notes and labels, which are text on a form that explains it.