public/adaptive-form.js

The client-side Adaptive Form renderer.

It:

  • Calls the Node.js /api/adaptive-form endpoint.
  • Reads the afModelDefinition returned by AEM Forms.
  • Traverses the form’s :items and :itemsOrder structure.
  • Detects panels and recursively renders their contents.
  • Maps supported Adaptive Form field types to standard HTML controls.
  • Uses properties from the AEM form model such as labels, names, visibility, enabled state, and drop-down values.

For example, an AEM field such as:

{
  "fieldType": "email",
  "name": "email",
  "label": {
    "value": "Your Email Address"
  }
}

is dynamically rendered as an HTML email input.

The renderer currently supports:

  • Panels
  • Text inputs
  • Email inputs
  • Telephone inputs
  • Date inputs
  • Drop-down lists

The renderer does not contain knowledge of the specific fields in the Adaptive Form. Adding another supported field to the form in AEM allows the client to discover and render it without adding field-specific code.

Application Flow

The responsibilities of the JavaScript files can be summarized as:

server.js
   |
   +-- Application and Express configuration
   |
   v
routes/adaptive-form.js
   |
   +-- Retrieves the Adaptive Form definition from AEM
   |
   v
public/adaptive-form.js
   |
   +-- Converts the Adaptive Form JSON into HTML controls
   |
   v
Headless Form UI

Announcements

Get hands-on with agentic AI.

Explore how AI agents work together through real examples and hands-on practice. Join your local User Group to design an agent workflow with your peers and leave with a practical framework you can apply to your own work.

Find an event

Ask AI

Not sure where to start?
Ask me anything about Adobe products.

Type your question or pick a suggestion below.

Use of this AI chatbot is subject to Adobe's Privacy Policy. Don't share sensitive data. AI responses are not your Content, may be inaccurate, and any offers provided are non-binding. Generative AI Terms.

Ask AI