Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Atomic Schema: Forms

Forms let you build a form or survey in an Atomic Server drive, publish it at a short link, and collect submissions without the visitor needing an Atomic Agent. This page describes the underlying data model; it does not describe the public submission API (see the endpoints documentation once that ships).

A Form’s submissions are kept in a regular Table: creating a standalone Form generates a data Class and a Table, while creating a form from an existing table reuses that table’s class and columns. Both store submissions as ordinary rows.

A visitor has no Agent, so the server itself writes each submission and reads the form’s definition. To keep that from reaching further than the form’s editor could, a form stays inside its own drive: its results table must be in the same drive (a submission to a table elsewhere is refused), and choice options, option images and the cover image are shown to visitors only when they are in that drive or publicly readable anyway. Questions cannot write the row’s parent, isA, drive or rights properties.

Forms from existing tables

Choose Create form from this table in the table’s resource context menu, name the form, and select its columns. The Forms section below the table lists its forms when any exist; several forms can write to the same table. In these forms, Back to table above the title opens the table to view responses, replacing the standalone form’s Results tab.

The builder adds only unused table columns, plus layout blocks. Question labels and compatible input types can change without renaming or changing the underlying column. Column names and choice options are edited on the table, using the Edit column on table link. Add new columns on the table before adding them to the form.

Columns in the row class’s requires list remain required. The builder warns when a required column is absent from the form. Removing a question keeps its column and collected data. Deleting a table also deletes its attached forms; deleting a table-created form keeps the table.

Standalone forms set form-owns-schema to true and can create and edit their generated columns. Forms created from tables leave it unset and are parented under the table.

Form

URL: https://atomicdata.dev/classes/Form

A form or survey that can be published and shared with a link.

Properties:

  • name - (required, String) the form’s title.
  • form-data-class - (required, AtomicURL, Class) the class of submission rows, either generated or reused from an existing table.
  • form-target-table - (required, AtomicURL, Table) the table submissions are written to.
  • form-owns-schema - (recommended, Boolean) whether the builder owns the generated schema. False or absent makes mapped columns read-only in the builder.
  • form-pages - (required, ResourceArray, FormPage) the form’s pages, in order.
  • form-published-at - (recommended, Timestamp) when the form was published. Absent means unpublished; submissions are only accepted while set.
  • form-open-at - (recommended, Timestamp) when a published form starts accepting responses. Absent means it is open as soon as it is published. Before this moment visitors get a 410 with a “not open yet” message instead of the form.
  • form-close-at - (recommended, Timestamp) when a published form stops accepting responses. Absent means it stays open until it is unpublished. From this moment on visitors get a 410 with a “closed” message. Bounds are half-open: a form is open at form-open-at and closed at form-close-at, and both are only consulted while form-published-at is set — publishing stays the master switch. They are compared against the clock on every request, so no scheduler is involved and a server that was down at the scheduled moment still opens and closes the form on time.
  • form-settings - (recommended, JSON) miscellaneous settings (e.g. progress bar, confirmation message).
  • form-styling - (recommended, JSON) visual theming for the published form. Keys (all optional): textColor, mainColor, backgroundColor (hex colors), roundness (one of: sharp, rounded, round), fieldSpacing (one of: small, large) sets the vertical space between blocks, showProgressBar (boolean, defaults to true) toggles the multi-page progress bar, animatePageTransitions (boolean, defaults to false) animates Next/Back page changes, and saveDrafts (boolean, defaults to true) keeps a visitor’s half-filled answers in their own browser so they can resume later — set it to false for kiosks and other shared devices.
  • cover-image - (recommended, AtomicURL, File) an image shown alongside or behind the published form. Served to anonymous visitors via GET /form/{id}/image (publish-gated), so the File itself needs no public read rights.
  • image-position - (recommended, String) where the image is positioned. One of: top, left, right, behind (full-page image behind the form card), full (form rendered directly on the image, no card) — enforced by the application, not the store (see note below).
  • form-submission-summary - (JSON, server-computed) aggregated submission statistics (response count, per-question option counts / number bins / answer samples), added to the resource by the server when a Form is fetched over HTTP. Ephemeral: it is never persisted and must never be written by clients.
  • form-access - (recommended, String) who can open the published form. One of: public (anyone with the link; the default when absent), invite-only (a valid, unused FormInviteCode is required to view and submit) — enforced by the application, not the store (see note below).

FormPage

URL: https://atomicdata.dev/classes/FormPage

A single page of a Form, holding a list of fields and layout blocks.

Properties:

  • form-fields - (required, ResourceArray) the page’s fields and layout blocks, in order. No classtype, since a page mixes input fields (FormField) with layout blocks (FormHeading, FormParagraph, FormInfoBox, …) and Atomic Data doesn’t support multiple class-types on one ResourceArray.
  • name - (recommended, String) the page’s title.
  • cover-image - (recommended, AtomicURL, File) an optional cover image.
  • image-position - (recommended, String) where the cover image is positioned. Same values as on Form (see above); currently unused by the builder, which themes at the Form level.
  • form-conditions - (recommended, ResourceArray, FormCondition) visibility predicates. All must match (AND) for the page to be shown; an empty list means always visible. Evaluated against answers from earlier pages.

FormField

URL: https://atomicdata.dev/classes/FormField

A single question in a Form. One class covers every field type — the type is tagged by form-field-type and its type-specific settings live in the form-field-options JSON bag, so changing a question’s type is always a single property write rather than swapping isA between per-type classes.

Properties:

  • name - (required, String) the question label.
  • form-maps-to - (required, AtomicURL, Property) the Property on the Form’s data class that this field’s answers are written to.
  • form-field-type - (required, String) the kind of question — one of the values in the table below, enforced by the application, not the store (see note at the bottom of this page).
  • description - (recommended, Markdown) helper text shown below the label.
  • required - (recommended, Boolean) whether an answer is mandatory.
  • form-field-options - (recommended, JSON) type-specific settings (placeholder, min/max, choice options, …); shape depends on form-field-type.
  • form-conditions - (recommended, ResourceArray, FormCondition) visibility predicates. All must match (AND) for the field to be shown. Hidden fields are not validated and their submitted values are dropped.

Question types

Each type fixes the datatype of the Property the answers are written to (form-maps-to), the shape of the form-field-options bag, and the JSON shape of a submitted answer. Options not listed for a type are ignored.

form-field-typeProperty datatypeform-field-optionssubmitted value
short-textStringplaceholder, minLength, maxLengthstring
long-textStringplaceholder, minLength, maxLengthstring
emailStringplaceholderstring, validated as an email address
phoneStringplaceholder, defaultCountrystring; the renderer’s country-select input submits E.164 (+31612345678), and the server also accepts digits with the usual separators and an optional + prefix
countryStringplaceholder, defaultCountryISO 3166-1 alpha-2 code ("NL"); the renderer shows the country’s name in the visitor’s own language
urlStringplaceholderstring, must start with http:// or https://
numberFloat or Integerplaceholder, minimum, maximumnumber
currencyFloatcurrency (ISO code), placeholder, minimum, maximumnumber
dateDate—"YYYY-MM-DD"
datetimeTimestamp—milliseconds since epoch
checkboxBooleandefaultValueboolean
radioStringoptionsone of options
dropdownStringoptions, placeholderone of options
multi-selectJSONoptions, minItems, maxItemsarray of options
dropdown-multiJSONoptions, minItems, maxItemsarray of options
picture-choiceStringoptions, optionImagesone of options
likertIntegerscale (2–11, default 5), minLabel, maxLabelinteger 1..scale
ratingIntegermax (2–10, default 5), icon (star/heart)integer 1..max
choice-matrixJSONrows, columnsobject mapping a row to one of columns
table-inputJSONcolumns ({label, type}, type text/number), minItems, maxItemsarray of row objects keyed by column label
addressJSON—object with any of line1, line2, postalCode, city, state, country; country is an ISO 3166-1 alpha-2 code, the rest is free text

defaultCountry is an ISO 3166-1 alpha-2 code. On a phone field it decides which country the number input starts on (the visitor can still switch); on a country field it is pre-selected as the answer. Leave it out and the visitor picks from scratch.

optionImages is an array of File subjects positionally matched to options, so renaming an option keeps its image. Because a published form has no agent, the definition JSON replaces those subjects with URLs on the publish-gated GET /form/{id}/image?file=… route (which only serves images this form actually references) — the Files themselves stay private, the same way the Form’s cover-image does.

minLength / maxLength bound how long a text answer may be, counted in UTF-16 code units (what String.length counts, so an emoji counts as two). A bounded question shows a 5/200 counter under its input. The maximum is not a hard cap — typing past it turns the counter and the field’s border red rather than swallowing the characters (and, on browsers that have opaque ranges, the overflowing characters themselves), and the answer is rejected on submit; the minimum is checked on submit only. Like the bounds below, they only constrain an answer that was given — an untouched question stays “unanswered”, which is what required is for.

minItems / maxItems bound how many options a multi-pick question accepts (and, on table-input, how many rows). Past the maximum the remaining options are disabled rather than flagged; the minimum is checked on submit. Both only constrain an answer that was given — an untouched question stays “unanswered”, which is what required is for.

Limits are class constraints

A question’s limits are JSON Schema keywords, the same ones a Class’s constraints map uses: minimum / maximum on number and currency, minLength / maxLength on text, minItems / maxItems on multi-pick and table-input. The class that answers are stored as an instance of (form-data-class) says what the column accepts from anyone: the choice options of a select are the enum of its constraint for the column, a single pick is maxItems: 1, a link points at class. The question’s own options may only tighten that. The definition (GET /form/{id}/definition) carries the narrowed result, and the server validates submissions with it. Forms stored with the older names (min, max, minSelected, maxSelected, minRows, maxRows) and options still on the Property (allowsOnly, max) keep working; the Property is only the fallback for a keyword the class does not set.

For required fields, “answered” is per-subfield on the composite types: a choice-matrix needs every row answered, and an address needs at least line1, city and country. An array or object whose entries are all empty counts as unanswered rather than as a partial answer.

FormHeading

URL: https://atomicdata.dev/classes/FormHeading

A heading layout block inside a FormPage’s form-fields list.

  • name - (required, String) the heading text.
  • form-conditions - (recommended, ResourceArray, FormCondition) visibility predicates, same AND semantics as on FormField.

FormParagraph

URL: https://atomicdata.dev/classes/FormParagraph

A paragraph layout block inside a FormPage’s form-fields list, rendered as markdown.

  • description - (required, Markdown) the paragraph body.
  • form-conditions - (recommended, ResourceArray, FormCondition) visibility predicates, same AND semantics as on FormField.

FormInfoBox

URL: https://atomicdata.dev/classes/FormInfoBox

A callout layout block inside a FormPage’s form-fields list — a paragraph in a tinted box, for the thing a respondent must not scroll past.

  • description - (required, Markdown) the box’s body.
  • name - (recommended, String) an optional title line above the body. An untitled box is just a styled paragraph.
  • form-info-box-style - (recommended, String) one of: info, note, tip, success, warning, danger. Enforced by the application, not the store (same limitation as form-field-type); an unset or unknown value renders as info.
  • form-conditions - (recommended, ResourceArray, FormCondition) visibility predicates, same AND semantics as on FormField.

info follows the form’s own accent color, so a themed form gets a matching callout without configuring anything. warning and danger are announced to screen readers (role="alert"); the quieter variants are read as ordinary text.

FormCondition

URL: https://atomicdata.dev/classes/FormCondition

A single visibility predicate on a page, field, or layout block. The parent lists its predicates in form-conditions; they are ANDed. Stored as a child of the thing it hides, so hierarchy rights keep them private to form editors — they appear in the public definition JSON only as denormalized { field, operator, value } objects (field is the referenced question’s form-maps-to property URL, not the FormField subject).

  • form-condition-field - (required, AtomicURL, FormField) the question whose answer is inspected.
  • form-condition-operator - (required, String) one of: equals, not-equals, contains, greater-than, less-than — enforced by the application, not the store (see note below).
  • form-condition-value - (recommended, JSON) the comparison value. Shape depends on the referenced field.

An unanswered or hidden referenced field fails the condition (the dependent stays hidden). contains is a case-insensitive substring on strings and membership on multi-select arrays. greater-than / less-than compare numerically, falling back to lexicographic string order (ISO dates work).

FormInviteCode

URL: https://atomicdata.dev/classes/FormInviteCode

A single-use invite code for an invite-only Form (form-access = invite-only). Codes are stored as children of the Form (their parent), so the hierarchy’s rights keep them readable by form editors only — they never appear in the public form definition. A code is consumed (its used-at set) when a submission is accepted with it; revoking a code is simply destroying the resource.

  • form-code - (required, String) the code value a visitor presents (as the code query parameter / submit body field).
  • used-at - (recommended, Timestamp) when the code was consumed by a submission. Absent means still usable.

Example

{
  "@id": "https://example.com/forms/contact",
  "https://atomicdata.dev/properties/isA": ["https://atomicdata.dev/classes/Form"],
  "https://atomicdata.dev/properties/name": "Contact us",
  "https://atomicdata.dev/properties/form-data-class": "https://example.com/forms/contact/data-class",
  "https://atomicdata.dev/properties/form-target-table": "https://example.com/forms/contact/submissions",
  "https://atomicdata.dev/properties/form-pages": ["https://example.com/forms/contact/page-1"],
  "https://atomicdata.dev/properties/form-published-at": 1710000000000
}

Note on form-field-type / image-position / form-condition-operator: allowsOnly can only restrict a property to a list of URL-parseable subjects, so it can’t hold plain enum strings like short-text. These properties are therefore unenforced Strings at the store level; the enum is validated by the form builder and the submission endpoint.