AEM Forms · updated

What are headless adaptive forms?

A headless adaptive form is a form delivered as JSON instead of as a web page. Your own application, on the web or on a phone, reads the JSON and draws the form with its own components, while AEM Forms keeps the definition. Adobe provides React packages and a starter kit, and says only core components support headless delivery today.

In plain words

The form's questions, rules and validation live in one JSON document. Any front end can show it. That suits teams who already have a design system and an app, and want forms inside it rather than an AEM page.

What the JSON looks like

Adobe's example forms in the aem-forms-af-runtime repository start with an adaptiveform version, a list of items, and metadata naming the rule grammar. Each item has a name, a fieldType and a label, plus optional constraints.

PropertyMeaning
adaptiveformSpecification version; Adobe's examples and the Edge Delivery block use 0.10.0
itemsThe fields and panels, in order
fieldTypeThe kind of field, for example text-input, number-input, date-input, drop-down, radio-group, checkbox-group, checkbox, multiline-input, file-input, email, button, panel
nameThe key under which the value is submitted
label.valueThe visible label
typeThe data type, for example string, number or boolean
required, minLength, maxLength, minimum, maximum, pattern, formatValidation constraints
enum / enumNamesOption values and their display names
constraintMessagesThe error message for each constraint
metadatagrammar json-formula-1.0.0 and version 1.0.0 in Adobe's examples

What Adobe provides

  • React packages: @aemforms/af-react-renderer and @aemforms/af-react-components, used with @adobe/react-spectrum.
  • A mappings object that maps each field type to a React component; you can replace components with your own.
  • A starter kit, react-starter-kit-aem-headless-forms, with a sample loan application form. It needs Git and Node.js 16.13.0 or later.
  • A .env file in the starter kit that chooses between the bundled form JSON and a form fetched from an AEM Forms server.

Adobe says you are free to render the form with any framework or language, and that for mobile and offline use the recommended approach is to build your own native app and fetch form definitions through the headless adaptive forms API.

A minimal form definition in the shape of Adobe's examples

{
  "adaptiveform": "0.10.0",
  "items": [
    {
      "name": "email",
      "fieldType": "text-input",
      "type": "string",
      "format": "email",
      "required": true,
      "label": { "value": "Email address" }
    }
  ],
  "metadata": { "grammar": "json-formula-1.0.0", "version": "1.0.0" }
}

Rendering it with Adobe's React packages (from the af-runtime README)

import { mappings } from '@aemforms/af-react-components';

const json = { /* form definition */ };
<AdaptiveForm mappings={mappings} formJson={json} />

How to try it

  1. Clone Adobe's react-starter-kit-aem-headless-forms and run npm install.
  2. Rename env_template to .env and keep USE_LOCAL_JSON set to true to use the bundled form.
  3. Run npm start to see the sample form.
  4. Replace the bundled form JSON with your own. The generator on this site writes a starting definition from a list of fields.
  5. Map any field type to your own component in the mappings file.

Related tools and pages on this site

Questions

Do I need AEM knowledge to build the front end?

Adobe says no prior knowledge of AEM is needed to develop headless adaptive forms; a front-end developer familiar with modern JavaScript frameworks can use them.

Can foundation component forms be delivered headless?

No. Adobe states that currently only core components support headless delivery.

Where do headless form submissions go?

Adobe's comparison table lists custom API endpoints for headless authoring, and says prefill, localisation and theming need a custom implementation.

Sources

Facts about Adobe's products on this page are from the linked Adobe pages, read on the date shown beside each. Explanations, steps and examples are ours unless marked as Adobe's. If Adobe's page and this one differ, Adobe's page is right.

Surge Migrate is not affiliated with Adobe and claims no Adobe partner status. Adobe product names are trademarks of Adobe.

Surge Migrate

Moving the website itself

This page answers one AEM Forms question. Surge Migrate moves a website from any CMS to any CMS. Converted automatically. Checked before you install.

  1. 1

    Scan

    Names the system behind your site, counts pages and templates, lists the blocks to build and the work no tool does, and gives an effort range with its working.

    Scan a site →
  2. 2

    Convert

    Each page becomes an Edge Delivery document, an AEM Core Component page and import files for 7 other systems. 10 pages free; 500 or 2,000 pages in one paid run.

    Convert your pages →
  3. 3

    Verify

    A download is offered only when its own format check passes. The report lists every field not found and every component kept as plain content. Compare old and new pages side by side.

    Parity check →
  4. 4

    Install

    You import with the target system's own tool, on your own environment. Each download's README gives the command. Your system changes only when you run it.

    How each import was tested →