Fieldia

The page format

A page is one JSON document with four parts: what it is about (data), what it holds (fields), how it is laid out (layout), and its name and title. Nothing in it is code, so a page can be stored, sent, generated or edited by a designer.

{
  "fieldia": "0.13",
  "id": "customer",
  "title": "Customer",
  "description": "Optional text under the title",
  "data": { "kind": "record", "model": "partner" },
  "fields": { "...": "..." },
  "layout": { "type": "sheet", "id": "sheet", "children": [] }
}

data: a record or responses

The model is only a name your data source understands; Fieldia passes it through.

fields: what the page holds

Each field is declared once, by name. The layout then points at it, so the same field can be described in one place and placed anywhere.

"fields": {
  "email": {
    "type": "char",
    "label": "Email",
    "help": "We send the joining details here.",
    "required": true,
    "pattern": "^[^@\\s]+@[^@\\s]+\\.[^@\\s]+$"
  },
  "country_id": { "type": "many2one", "label": "Country", "relation": "country" }
}

Every field has a type and a label, and may have help, required, readonly and a default. Each type adds its own options — options for a selection, relation for a link to another record, min and max for a number. Fields lists them all.

A value can also start from the record, as Flectra's context="{'default_…': …}" does. defaultFrom works out a new record's or line's first value — "defaultFrom": "user" starts it with the person using the form, as a link. A one2many's lineDefaults give each new line its values from the record — { "project_id": "project_id" }, a field named alone taken whole — and a link's createValues what a record made from it starts with, by Create and edit… or at once from what was typed.

layout: how it is arranged

A page's layout is one of five kinds:

LayoutFor
sectionsA form in titled sections, each with 1 to 4 even columns, or rows each divided in twelfths. Sign-ups, settings, simple records.
sheetA business record: a title (with an optional photo and fields over and under it), a statusbar, buttons, stat buttons, badges, a ribbon, alerts, then sections and tabs, and an optional side panel. See the parts of a sheet.
tabsTabs at the top level, each holding sections and fields.
wizardSteps, one at a time, with a progress bar. A step whose condition is false is skipped — that is how a survey branches. Steps can be clicked, skipped when optional, and its buttons named — see wizards.
listMany records as a table, with a search bar, filters, group by and favourites, and buttons for the records chosen. It names columns, not children — see lists and search.

Inside them, these nodes can be nested freely:

NodeWhat it is
fieldA field, by name: { "type": "field", "id": "email", "field": "email" }. It can override the label, choose a widget (such as radio or tags), set a placeholder — or words chosen by a condition, "placeholderWhen": [{ "when": "is_company", "text": "e.g. Lumber Inc" }], the first that holds, as Flectra's two name fields (a sheet's title takes them too; in the designer, Placeholder, Other words while) — name what the browser fills its box in with and the keyboard a phone shows ("autocomplete": "given-name", "inputmode": "numeric": filled in by the browser), span colspan columns, take the focus as the record opens with "focus": true (a sheet's title too) (Flectra's default_focus: in a page, a dialog or a panel, the first such field shown, never from someone busy elsewhere on the screen; in the designer, Focused as the record opens), and carry conditions. A table of lines also takes columns, totals, optionalColumns, order, editMode and rules of its own — cells, rowTones, rowBold, rowButtons, lineDelete, selectedButtons, controlButtons, lineOpens, cards, fit — see tables of lines, a table's own rules and its buttons. Any field takes tones and bold (a value in a tone), and any part hideOn (on a phone); a field, a section, a tab and a related list "print": false, left out on paper (on paper).
sectionA titled group with columns (1–4, or a count for each width), an icon and a description. tracks gives its columns their own widths — pixels, a share of the row or of what is left: ["50%", "1fr", "1fr"], one for each column, from a tablet's width up — and gap the room between them, in pixels. "foldAt": "end" puts its fold control at its heading's end as ^ and ⌄, and maximise a ⤢ beside it that shows the group alone over the record's body until Escape; with either, its heading is a work item's: 16px words over a rule, the tools at its end showing while it is pointed at or worked in. A group holding one field alone, its label out of sight, takes that field's own tools into its heading — a Markdown text's Edit and Done. With collapsible its title folds and unfolds it; add collapsed to start folded. A folded section opens by itself when one of its fields stops a save. A section can sit inside another: two in a two-column section are the two groups of an Odoo header. An untitled plain section of twelfths led by a field with its label beside is a row, as Odoo's o_row: that label lines up with the labels round it, and the parts share the room of the values — fitting even one column of a two-column group.
tabsTabs, each a tab with a label, an icon and children. A tab's parts are drawn when it is first shown, and kept up to date only while it is shown, so a page of many tabs opens and types as fast as one; a tab with a problem in it is marked, and a save stopped there opens it at the problem.
buttonA button that names an action, with an icon if you like. Fieldia hands the press to your app with the record; your app decides what it does. It can ask to confirm first.
textA heading, a paragraph or a note — or "style": "help": help in a light box with room for an icon at its start, as a work item's Deployment note. [words](https://…) in any text's words is a link (web and mail addresses only), opened in a tab of its own.
slotA named place your app fills with its own content — an activity feed, a map, a chart.
imageA picture between parts: its src and its alt, what it shows for those who cannot see it — empty only for a picture that is decoration. width: small (160px), medium (320px), large (480px), full or a number of pixels, never wider than its row; align: start, center or end; href: a web or mail address it opens in a new tab; caption: words under it, translated with the page's others.
divider, spacerA line across the row, and empty room.
formA saved form placed whole — an address made once, placed wherever a form asks for one: { "type": "form", "id": "home", "page": "address", "name": "home_address" }. page is the saved page's id; version keeps to a published version, the latest when left out. Its answers go under name as an object, { "home_address": { "street": … } }, so two copies never mix; its own required fields, rules and worked-out values hold inside it. title: the saved page's own when left out, none when empty. The viewer finds the page through its pages option.

Every node has an id, unique in the page. Ids are what a designer, a test or your app use to find a node.

The parts of a sheet

{
  "type": "sheet", "id": "sheet",
  "title": {
    "field": "name", "avatarField": "image",
    "above": [
      { "type": "field", "id": "f-type", "field": "company_type", "widget": "radio" }
    ],
    "below": [{ "type": "field", "id": "f-sold", "field": "sale_ok" }]
  },
  "statusbar": { "field": "state", "clickable": true, "position": "header" },
  "badges": [
    { "id": "b-key", "label": "Key account", "tone": "success", "icon": "star",
      "invisible": "sale_order_count < 10" }
  ],
  "alerts": [
    { "id": "a-limit", "message": "Over the credit limit.", "tone": "warning",
      "dismissible": true, "invisible": "not over_limit" }
  ],
  "children": []
}

How a dense sheet reads

What a Flectra sheet shows besides its fields, each checked when the page is: a ribbon or several, alerts that hold a field's value or a button, stat buttons that write their value as its field does, a statusbar that hides and times its steps, keys on buttons, parts on one line, and a label over the title.

{
  "type": "sheet", "id": "invoice",
  "title": { "field": "name", "label": "Customer Invoice" },
  "statusbar": { "field": "stage_id", "clickable": true, "saves": true, "fold": true,
    "durationsField": "duration_tracking", "invisible": "not active" },
  "buttons": [
    { "type": "button", "id": "b-post", "label": "Confirm", "hotkey": "v", "action": "action_post" },
    { "type": "button", "id": "b-draft", "label": "Reset to Draft", "hotkey": "shift+g", "action": "button_draft" }
  ],
  "statButtons": [
    { "id": "s-paid", "label": "Paid", "field": "amount_paid", "action": "open_payments" },
    { "id": "s-sold", "label": "Sold", "field": "sales_count", "unitField": "uom_name", "unit": "Units", "action": "open_sales" },
    { "id": "s-moves", "label": "In", "field": "nbr_moves_in", "secondField": "nbr_moves_out", "secondLabel": "Out", "action": "open_moves" },
    { "id": "s-meeting", "label": "No Meeting", "labelField": "meeting_display_label", "field": "meeting_display_date", "action": "open_meetings" }
  ],
  "ribbons": [
    { "id": "r-paid", "label": "Paid", "tone": "success", "invisible": "payment_state != 'paid'" },
    { "id": "r-outcome", "label": "Closed", "labelField": "outcome", "invisible": "not outcome" },
    { "id": "r-legacy", "label": "Legacy", "tooltip": "Made in the old invoicing app", "invisible": "not legacy" }
  ],
  "alerts": [
    { "id": "a-lock", "message": "Entries before {tax_lock_date} cannot be posted.", "tone": "warning" },
    { "id": "a-credit", "message": "", "messageField": "partner_credit_warning", "invisible": "not partner_credit_warning" },
    { "id": "a-dup", "message": "This bill may be a duplicate.",
      "buttons": [{ "type": "button", "id": "b-dup", "label": "See it", "action": "open_duplicate" }] }
  ],
  "children": [
    { "type": "section", "id": "price", "title": "Pricelist", "style": "inline", "children": [
      { "type": "field", "id": "f-pricelist", "field": "pricelist_id" },
      { "type": "button", "id": "b-update", "label": "Update prices", "style": "link", "action": "update_prices" }
    ] },
    { "type": "text", "id": "t-top-up", "text": "Top up {topup_amount} to reach the minimum.", "style": "alert", "tone": "warning" }
  ]
}

Wizards

{
  "type": "wizard", "id": "survey",
  "clickable": true,
  "nextLabel": "Continue", "backLabel": "Previous",
  "finishLabel": "Send my answers",
  "children": [
    { "type": "step", "id": "step-about", "label": "About you", "icon": "user",
      "children": [] },
    { "type": "step", "id": "step-extra", "label": "Your experience",
      "optional": true, "children": [] }
  ]
}

clickable lists the steps over the form: any step behind can be gone back to at once, and a step ahead only past steps that are complete — the first one with a problem stops the jump and shows it. An optional step offers Skip: its answers are then left out, and its required questions are not asked for, unless someone goes back to it and on.

Endings, and the answers in a page's own words

A page of responses says what it says once it is sent with endings: the first whose when holds on the answers as they were sent — with what your data source answered, the response's id and the values it added — else the one with no when, shown otherwise, which comes last. Its title and text show {field}s as a text's words do, and {id} the reference your app gave the response; each line of text is a paragraph, and [words](https://…) a link, whose address may hold a {field} too (the value as it is kept: a choice's value, a link's id). again is its button's words — "Book another" — or false for none. The ending takes the focus as it shows, so a screen reader reads it, the reference with it. Without endings, "Thank you. Your answers were sent.", as before; a redirect after sending is a step, on.afterSave's openUrl with its when.

"endings": [
  { "when": "overall <= 2", "title": "We are sorry, {name}",
    "text": "Someone from {branch} will call you today.", "again": false },
  { "title": "Thank you, {name|and see you soon}",
    "text": "Your booking is {id}: {day} at {time}.\n[Add it to your calendar](https://clinic.example/b/{id}.ics)",
    "again": "Book another" }
]

{field} shows an answer given in a page's own words beyond a text's and an alert's: a field's label and help — its own, or its part's — each choice's words, a step's label and description, a wizard's nextLabel, backLabel and finishLabel, and a button's label: "How was your visit to {branch}?" reads "How was your visit to Zamalek?" once the branch is chosen, and again as it changes. Each value reads as people read it — a choice by its label, a link by its name, money with its currency, a day in the page's order (look.dateOrder: Oct 15, 2026 month first), a yes or no in words — and the form's messages name the field as its label reads (Please answer “How was your visit to Zamalek?”: a label that is a question — ending with a question mark, or with an ellipsis the answer completes — is quoted in the language's own marks wherever a sentence names it, and asked for when it is required; a label that is a name reads Your name is required). After a bar, the words said while the answer is empty: {branch|this branch} reads "How was your visit to this branch?" until a branch is chosen — the page's own words, translated with the rest of its words, drawn as the words round them; without them, an empty answer says nothing. A {name} that is no field of the page is refused by the page check, wherever it is written, with words after its bar or not. These words, and the endings, come in a part of their own, fieldia.answers.js, loaded before a page that has any; a page with none never loads it.

A quiz's results

A page of responses with quiz shows each person their results once they send: their score — You scored 5 of 8 (63%) — and each question asked marked Right, Wrong or Not answered, its points, their answer, the right answer to one they missed and the question's feedback. A choice's right answers are its options marked "correct": true (several: right is exactly those); a question typed names the answers it takes in its field's quiz.answers — words whatever their case and spaces, a number by its value. A right answer earns its question's quiz.points, else the page's quiz.points, else 1; a choice whose options carry points (score) earns those, marked neither right nor wrong. "results": "later" says the results come once you have reviewed them; "rightAnswers": false keeps the right answers back. A quiz has no pass mark of its own yet: your server may answer the send with a value of its own (values: { passed: true }), which an ending's when reads.

"quiz": { "results": "now" },
"fields": {
  "reversible": { "type": "selection", "label": "Which filler can be dissolved?",
    "options": [{ "value": "ha", "label": "Hyaluronic acid", "correct": true },
                { "value": "caha", "label": "Calcium hydroxylapatite" }],
    "quiz": { "feedback": { "right": "Yes: hyaluronidase dissolves it.",
                            "wrong": "Only hyaluronic acid can be dissolved." } } },
  "minutes": { "type": "integer", "label": "Minutes to watch a patient after?",
    "quiz": { "answers": [30], "points": 2 } }
}

The right answers travel in the page, where anyone who reads its JSON finds them. A test where that matters leaves correct and answers out, marks the answers on your server, and answers the send with its results: submit returns { quiz: { score, max, questions: [{ field, points, max, right, answered, rightAnswer?, feedback? }] } }, shown in place of the page's own. The form keeps them as form.getState().sent.quiz. The results come in the survey flow's part, fieldia.surveyflow.js, loaded before a page with a quiz is drawn.

A review before sending

A page of responses with review shows every answer before it is sent: its last step's button — a page of sections', its Submit — reads Review your answers, the answers are checked as Next checks them, and the questions give way to each answer by step (or by titled group), each with Edit back to its question, then Back and the page's own words to send. true says it in Fieldia's words, Check your answers; a title and text in the page's. From a step before the last after an Edit, Back to review shows them again once the steps on the way are complete. A saved form placed in a step is not listed in it yet. It comes in the survey flow's part, fieldia.surveyflow.js.

"review": { "title": "Before you send", "text": "Press Edit to change an answer." }

One question at a time

"flow": "one" asks a page of responses' questions one at a time, as Typeform does: each question on a screen of its own with the words before it, its group's or step's title over it. Enter or OK goes on once its answer is checked; a choice of one picked by the pointer or by its letter (A, B, C… beside each option) goes on by itself; ↑ and ↓ (and Page Up, Page Down) go back and on where no box takes those keys; Question 3 of 12 and a bar say how far. A question an answer hides is passed over. On a wizard its steps are entered, checked and kept in drafts as ever; a form opened with answers starts at the first still to answer. With review, the last screen reviews the answers, and Edit comes back to its question's screen.

{ "data": { "kind": "responses" }, "flow": "one", "review": true }

Questions in an order drawn, and N of M

On a page of responses, a wizard's "order": "random" shows its steps in an order drawn for each respondent, a step "fixed": true keeping its place; a step's or a group's "order": "random" its questions — words, pictures and a question fixed keep their places. "draw": 5 asks 5 of its questions, drawn: the others are not asked, not required and not sent. The draw is seeded — your app's seed (an invitation's code), else the person's id, else one of the browser's — so a person who comes back to their draft finds the same questions; it is sent with the answers as order, by part, the ids in the order shown.

{ "type": "step", "id": "bank", "label": "From the question bank", "order": "random", "draw": 2,
  "children": [ { "type": "field", "id": "q1", "field": "kit" }, { "type": "field", "id": "q2", "field": "record" },
                { "type": "field", "id": "q3", "field": "left" }, { "type": "field", "id": "q4", "field": "signs" } ] }

A time limit

timeLimit on a page of responses gives it a time limit: said before its questions with Start, a countdown over them once started, a warning warn minutes before its end (1 unless said), and as it runs out the answers sent as they stand ("then": "send", the default) or locked for the person to send ("lock") — the page says which. A step may have its own: it counts from when the step is first entered and, as it runs out, keeps that step's answers as they are while the form goes on (lock, a step's default), or sends the whole page (send). Answers sent on time are sent as they stood: a required one not given goes empty. The clocks are kept in drafts with the answers — in the tab's own store where the app keeps none — so a reload goes on with the time left, or, past its end, says the time is up and sends or locks as the page says: a reload is never a way round a limit. Once sent, the draft goes with the answers: a reload then starts a new response, its own clock with it — one response per person is the app's limits.onePerPerson, as on any page of responses. The send tells started and timeUp — the browser's clock; a server that must be sure keeps its own.

"timeLimit": { "minutes": 20, "warn": 2, "then": "send" }

Columns at each width

columns can give a count for each width of the form: wide above 760px, medium up to 760px, narrow up to 520px. A width left out stacks the way the skin does by itself — the outlined skin keeps its columns until the form is narrow, the underline skin, whose labels sit beside their values, stacks at medium. On a narrow form — a phone — every label goes above its value, the page's or a group's "labels": "beside" too, in every theme: the value has the whole width, never cut to +20 100 912 4…; a title gives its picture the line under it rather than break its words.

{ "type": "section", "id": "header", "columns": { "wide": 2, "medium": 2 }, "children": [] }

Page width, and where Save sits

The page itself takes maxWidth — narrow (640px), medium (900px), wide (1180px, a sheet's own) or full — and actionsPosition: top or bottom. A page of responses anyone may send takes botCheck: a hidden box, the fewest seconds, a captcha's slot (a public form's bot check). Any page that starts answers takes prefill: the fields the link it is opened with fills, a hidden field sent with the answers (fields filled from the link); and payment: a fee taken through your own provider before its answers go (a payment the answers wait for); and outbox: sends made without signal kept on the device and sent when it comes back (sends kept without signal). A sheet keeps Save and Discard at the top unless told otherwise, a sections page at the bottom; a wizard keeps its own buttons.

And phone: how its phone fields read and show numbers the world over — { "country": "EG", "shown": "national" }, the country a number typed without its + is read in, and whether one is shown at home's way or abroad's. Left out, a phone field is a text box. See phone numbers the world over.

And timeZone: the time zone its dates and times are in, by its IANA name — "Africa/Cairo", "Europe/Berlin" — shown and typed on that zone's clock wherever the person is, today being its day there. A date and time field may name its own. See time zones.

And, on a page of responses, limits: when it takes answers and how many — { "opens": "2026-11-01T09:00", "closes": "2026-11-20", "maxResponses": 200, "onePerPerson": true, "message": "…" }, the dates on the page's clock, the counts from the data source — a closed form saying so in place of its questions as it opens; and on any choice's option, seats: how many may pick it, its places left shown and a full one refused. And continueLater: the answers kept on the app's server as they are typed, with Continue later and a link to carry on from any device. See opening, closing and limiting a form and save and resume.

And, on a record's page, approval: its records wait for approval as the data source says — who it waits for, Approve and Reject, its history — locked meanwhile but the fields it names open: { "open": ["notes"] }, or { "lock": false }. See approvals on a record.

And, on a record's page, duplicates: the fields records like the one typed are found by — { "fields": ["name", "phone", "email", "vat"] } — asked of the data source as they are typed and as the record is saved ("on": "type", the default), or only as it is saved ("on": "save"). Each match is said under the field it matched on, with Open it, "It's someone new" and Merge. See possible duplicates.

And records: what its records are called, so Fieldia's own sentences name them as your business does — A customer with this phone already exists, 17 customers imported, Are you sure you want to delete this customer?, New customer, 1–10 of 1,284 customers — where they said “record”, or no noun at all:

{ "records": { "one": "customer", "other": "customers", "a": "a customer" }, "lowerLabels": true }

one and other are the words for one and for more, as they stand inside a sentence. a is one with its article where the language puts one before it — an invoice: Fieldia never guesses an article, so a sentence that needs one says A record until it is given. The page's own lowerLabels, beside records, writes a field's label with a small first letter wherever one of Fieldia's sentences puts it after a word — A customer with this phone already exists, Choose at least 2 for interests, Fix tax rate to see total, Not saved. Check: email — while one that begins its sentence keeps its capital: Phone is required, Status: nothing is called “Prospect”. Off unless said, as only the page knows whether that is right: a label whose first word is a name (IBAN, VAT number, WhatsApp) stays as written, and so does every label in a language that writes its nouns with a capital, or has none. A page asks it with its records named or not, a survey too; a line's own dialog follows its record's page unless the line's own page says otherwise. Other languages come through translations, as the page's other words do. A related list says New, View all and None in the words its model's own page gives (New invoice, View all invoices, No invoices yet.). A language with no such sentence says its own plain one; a page without records reads as before.

A sheet or a sections page may give its own buttons at its footer, as a Flectra wizard does — Mark as Lost and Cancel. They stand in place of Save and Discard, and in a dialog or panel in place of Save & Close and Discard. Each is a button like any other: once its steps saved, the dialog closes with the answers; a close step closes it without them; Ctrl+Enter presses the primary one.

Icons

Sections, tabs, buttons, stat buttons, badges and steps take an icon by name. Fieldia draws these itself, as lines in the colour of the words beside them:

Add your own, or replace one, with the viewer's icons option: the inside of a 24×24 SVG, by name.

mountViewer(host, {
  page,
  dataSource,
  icons: { rocket: '<path d="M12 2c4 3 6 8 6 12H6c0-4 2-9 6-12z"/>' },
});

Conditions: invisible, readonly, required

A field node, a section, a tab, a step or a button can be hidden, locked or made required by a condition written in the page. A condition is true, false, or an expression over the record's values:

{ "type": "field", "id": "other_role", "field": "other_role",
  "invisible": "role != 'other'",
  "required": true }

{ "type": "field", "id": "discount", "field": "discount",
  "readonly": "state in ('done', 'cancel') or not is_company" }

Expressions read like Python: == != < > <= >=, in and not in with a list — ['draft', 'sent'], or Python’s tuple ('draft', 'sent') as Flectra writes it — and or not, True False None, numbers and quoted strings. An empty value is false, and as in Python and and or give the value that decided: discount or 0 is a number. Conditions are checked again on every change, and a hidden field's value is left out of what is saved or submitted.

A field's compute — a value worked out as people type — and setWhen use the same expressions, with arithmetic and functions: round(x, 2), age(birth_date), addMonths(first_due, 1), join(' ', first_name, last_name), and over a table's lines sum(lines, 'amount') and count(lines), each taking a condition on the lines in quotes: count(requirement_ids, "state == 'done'"). While what a value is worked out from holds text that does not read — "abc" in a line's Quantity — the value waits, a dash said in words (Fix line 1 of Order lines to see Untaxed amount), as the table's own total does: never an amount counting the value that text replaced. An amount your app works out as the lines change (read-only, from a source with an onchange) waits the same. So does a value worked out from an answer the form refuses — an area of −50 under its min, a day past its max: 'today': Fix Area (m²) to see Price per m², never −120,000.00 — whether it is the page's own formula, Fieldia's function or your app's.

A setWhen acts as its condition starts to hold; with on, as one of those fields changes instead — Flectra's onchange: { "on": ["certification"], "when": "certification", "value": "'scoring_without_answers'" } sets the scoring when Certification is ticked, and never as something else makes its condition hold. Its when may then be left out: set at every change.

A section's readonly locks every field inside it, sections within it too: a blocked customer's whole credit section, say.

Besides the page's fields, a condition reads id, the record's id — empty while it is new, so not id hides what only a saved record can do — and user, the person the app says is using the form: user.id, user.name and user.roles. A page's own field of the same name comes first. On a line — a worked-out value, a value set by a condition — parent is the record the line is on: parent.discount, parent.state == 'sale'. A link's filter may compare with any of these too, its valueFrom naming user.id, or on a line parent.company_id.

roles shows a part only to people holding one of them, as Flectra's groups=; a role written with ! hides it from people who hold that one. Any part takes them — a field, a section, a tab, a button, a stat button. The app names the person with the form's user option, { id, name, roles }; without it they hold no role. Roles decide what a page shows, not what someone may do: the app's server checks that.

{ "type": "button", "id": "lock", "label": "Lock", "action": "action_lock",
  "roles": ["sales_team.group_sale_manager"], "invisible": "not id" }

context holds the values your app passes in, as Flectra's context: mountViewer(host, { page, context: { restricted_picking_type_code: 'incoming' } }) — the same context option in React, Vue and Angular, and on createForm. A condition reads context.restricted_picking_type_code == 'incoming', and a link's filter compares with one, { "field": "code", "op": "=?", "valueFrom": "context.restricted_picking_type_code" } — with =?, left out when the app gives none. They are the app's values, never the page's: nothing saves them, a dialog the page opens reads the same ones, and a page's own field named context comes first. The designer's conditions read them too.

editing says whether the record is being edited: false while a view shows it locked — the Edit switch before Edit is pressed, or the app's setReadonly(true). "invisible": "not editing" is a part for editing only, Flectra's oe_edit_only, and "invisible": "editing" one for reading only; a form always being edited shows its editing parts. In the designer it is Shown while.

A condition that names a field the page does not have is refused when the page is checked, not when someone fills it in.

Functions, and your app's own

Fieldia's own, by what they work on:

A function there is not, or given too many or too few values, is refused as the page is read. A value of a kind a function does not take — age(notes): age takes a date as its first value; "notes" is text — is a warning, never a refusal: validatePage passes the page and says it in warnings, the designer as a fix to make, and the form runs it as before, the call giving nothing. A function given a value it cannot use gives nothing, never an error.

Your app gives its own with functions, on the viewer, createForm, the React, Vue and Angular components and the designer, and a page calls them by name. One that asks your server returns a promise: the value worked out from it shows an ellipsis while it is asked — Working out Total… —, is asked once for the same values, and is laid only on the record it was asked for; a save waits for it, and one whose answer did not come is asked again as the person saves.

mountViewer(host, {
  page,
  functions: {
    vatRate: { takes: [1, 1], values: ['text'], gives: 'number', call: (country) => RATES[country] ?? 0 },
    districtPrice: { asks: true, call: (district) => api.average(district) },   // a promise
  },
});

Options that follow the answers

An option may show only while a condition holds — written as a part's invisible — and a choice may offer the options picked in an earlier one, its own after them:

"features": { "type": "selection", "label": "Features", "multiple": true, "options": [
  { "value": "garden", "label": "Garden", "invisible": "unit_type != 'villa'" },
  { "value": "lift",   "label": "Lift",   "invisible": "unit_type == 'villa'" } ] },
"again": { "type": "selection", "label": "Which would you have again?",
  "options": [{ "value": "none", "label": "None of them" }],
  "optionsFrom": { "field": "treatments" } }

With "picked": false, the options left unpicked there; a None of these is never carried. A chosen option a change no longer offers is taken out of the answer and said under its field — Garden is no longer offered, so it was taken out — never silently kept, and said while it is true: picked again, or offered again (Villa picked again), the words go; one a record held as it was opened stays, and is said to be no longer offered. A table line's choice takes conditions too, read on the line's own values and the record it is on (parent.): an option a change of the line hides is taken out and said under its cell in the same words, as one its app's list no longer offers is. In the designer: Show when… in an option's row, and Picked in another question among a choice's Choices.

Checking a page

import { validatePage } from '@fieldia/core';

const checked = validatePage(json);
if (!checked.ok) console.log(checked.issues);   // [{ path: 'layout.children[0]...', message: '...' }]

validatePage checks the shape, key by key, that every id is unique, that every field a node or a condition names exists, and that every condition parses. Run it where pages are made and tested: in a designer, in your tests, in CI — where npx fieldia-check pages/, from @fieldia/testing, checks every page your app keeps in one line (see testing). The viewer runs checkPage before it draws a page, refusing what 0.35's viewer refused — the outline, every name, every condition. A page it refuses is never drawn: its form's place says why, its problems listed under "What is wrong", and onError is told; in React, Vue and Angular the app around it stays. After the first draw it runs the whole check, checkPageWhole: the same verdict as validatePage — the format's schema, made from the same definitions, and the same rules — without the validation library, in a part of its own. In 0.36 what only the whole check finds is said, once in the console and to onError as a warning, and the page stays drawn; from 0.37 it is refused (page.invalid). Writing pages with an AI agent? See the guide for agents. For editors and other languages the format is also a JSON Schema: @fieldia/core/page.schema.json.

From a schema: JSON Schema, OpenAPI, a model's fields

An app with an API or a backend already describes its records. pageFromSchema(input, options) makes a starting page from that description — a JSON Schema, an OpenAPI document (an operation's request body and parameters, or a component's schema: schema: 'POST /enquiries'), or a model's fields (Fieldia's own, or a backend's field list such as Flectra's fields_get): each property a field of its kind, with its label, help, whether it is required or read-only, its limits, its pattern, its choices and its default; a date, an email, a link, a file by its format; a list of objects a table of lines; an object's properties a section of their own. What no field holds is kept as JSON, and said; what cannot be read is left out, and said — notes and unmapped beside the page, each with its property's path. In the designer it is Start from a schema… on a blank page, which shows all of this before anything changes.

import { pageFromSchema } from '@fieldia/core';

const { page, notes, unmapped } = pageFromSchema(openApi, { schema: 'POST /enquiries' });

Versions: a page from an older Fieldia, or a newer one

"fieldia" says which format a page is written in. This Fieldia reads and writes format "0.13" (FORMAT_VERSION), and reads a page in 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 0.10, 0.11 or 0.12 as it is; FORMAT_VERSIONS lists every format Fieldia has had. When a release changes what a page may say, the format gets a new version, and every reader of a page brings one in an older format up to date before anything else: checkPage, validatePage, createForm, the viewer and the saved forms placed in a page, and the designer, which then edits and saves it in the new format. That is upgradePage, which you can call yourself — say, to bring the pages your app keeps up to date as it loads them:

import { upgradePage } from '@fieldia/core';

const stored = await db.pages.get(id);
const page = upgradePage(stored); // the same object when it is already in the current format
if (page !== stored) await db.pages.put(id, page); // kept in the new format from now on

A page in an older format is copied and brought up step by step — each step after its own format, in order — and the page you gave is never changed. A page newer than the Fieldia reading it is not guessed at: it is refused, with words that say so, where an older Fieldia would have named the first setting it did not know.

fieldia: this page is in format 0.14, newer than this Fieldia reads (0.13): update Fieldia to show it

A page saved in the lowest format it needs

A page says the oldest format that has every setting it uses, not the newest: the designer publishes each version so, and stampPage(page) stamps a page your app makes or an agent writes before you store it (lowestFormat(page) says which). A form with words, numbers and ticks says "0.1", a field kept out of drafts (secret) "0.13" — so a viewer of an older Fieldia that knows every setting a page uses reads it, and one that would not know a setting refuses the page rather than draw it without that setting. Half of Fieldia's example pages need nothing past format 0.1. Which format each setting, each kind of part and each value came in is read from the format's own history: each format's JSON Schema as it was released.

import { stampPage, lowestFormat } from '@fieldia/core/schema';

lowestFormat(page);              // "0.1" — or the format of the newest setting it uses
await db.pages.put(id, stampPage(page)); // read by every Fieldia that reads that format

A page is read by its stamp. One that says an older format than a setting it uses came in would be read by an older Fieldia without that setting. In 0.36 the whole check a viewer runs after the first draw (checkPageWhole) says so once in the console and validatePage among its warnings, at that setting; from 0.37 both refuse it (a deprecation: format.under-stamped):

fields.pin.secret: this came in format 0.13, but the page says it is in format 0.10, which a Fieldia reading 0.10 would read without it: write "fieldia": "0.13" — lowestFormat(page) gives the lowest a page needs

Defaults that changed

From 0.36 a default that changes is a new format, whose step writes the old default into a page of an older format, so that page keeps doing what it did (see the release train). Before it, these changed for every page; each has the setting that keeps the old way:

FormatWhat a page does nowWhat it did beforeTo keep the old way
0.6 (Fieldia 0.27)A choice its list no longer offers after a change is taken out of the answer, and said ("Garden is no longer offered, so it was taken out").It was kept, and sent.Nothing keeps it: a value the list no longer offers could be sent, which no list would take.
0.7 (Fieldia 0.28)A table of lines is drawn as cards on a phone.Its rows kept the table at a phone's width.On the table's node, "cards": "never".
0.10 (Fieldia 0.31)A week starts where its reader is: the page's own region, else the reader's, else the region its language is most spoken in.Saturday for Arabic, Monday for every other language.Name the page's region in its language ("language": "en-GB" starts on Monday), or give a list's calendar its first day ("firstDay": 1).
0.11 (Fieldia 0.32)A phone's country is picked from Fieldia's own list, found by typing.From the browser's own list.On the page, "phone": { "countries": "native" }; on one phone field's node, "options": { "countries": "native" }.

How the format changes. A release that adds to what a page may say — a new setting, a new kind of part — makes a new format version; a page needs nothing rewritten, and upgradePage writes the new version in it. A release that renames or reshapes a setting also adds a step to PAGE_UPGRADES: what changed, in plain words, the rewrite, and a page before and after it, which Fieldia's tests run, so no step goes untested. Format 0.1 is the first: it grew from Fieldia 0.1 to 0.20 under one version. Format 0.2 came with Fieldia 0.22, 0.3 with 0.24 (a time zone, phones, booking slots, a list's totals, periods, Export and Edit, a box's autofill purpose, a public page's bot check), 0.4 with 0.25 (a record's related lists, a list's cards, gallery, columns people shape, rows' own tones and buttons, Import and Print, a page's print look and its possible duplicates), 0.5 with 0.26 (what a page calls its records and its labels written small inside a sentence, a tab counting a related list, a related list opening the app's own way, a part left off paper, a key to what rows' tones and bold mean), 0.6 with 0.27 (endings chosen by the answers and answers in a page's own words, when a form opens and closes and how many it takes, places per choice, Continue later, a signature that signs answers, options shown by a condition or carried from a question, a table line's choices from the app's lists, a list's filter ranges, counts and phone sheet), 0.7 with 0.28 (a table of lines kept as rows on a phone, where it would be cards), 0.8 with 0.29 (a record's approvals, a list's cells changed in place, a text kept in several languages, AI help's Fill from text, a text field's Draft and Polish and a list's search in plain words, a photo set, a field scanned with the camera), 0.9 with 0.30 (a menu's dividers and menus inside it, the app's items as a menu opens, a formatted text read first), and 0.10 with 0.31 (a list's rows opened in place, ranked by hand, loaded as it scrolls and its tree loaded as it opens, a Gantt timeline, a month or a year alone and Hijri days, options with a second line, an icon or a colour, a quiz, a review, one question at a time, random order and time limits, the fields a link fills, a payment, an offline outbox, record templates, Undo on a button's toast), 0.11 with 0.32 (how a phone's country is picked: Fieldia's own list found by typing, or the browser's), and 0.12 with 0.33 (how a page waits: each moment's way — a skeleton, a spinner, a bar, words — its looks, its timing and a failure's way, on the page, a list, a related list, a map and a field's search); each only added, so no step has been needed yet. Versions compare as numbers: 0.10 comes after 0.9. From 0.21, the release tool refuses to publish a format whose shape changed under its old version. What each release changed is in the changelog.