Create an Adaptive Form Fragment

You can create an Adaptive Form Fragment from scratch or save a panel in an existing Adaptive Form as fragment. To create a form fragment:

  1. Log in to your AEM Forms instance at https://[hostname]:[port]/aem/forms.html.

  2. Click Create > Adaptive Form Fragment.

    Create Adaptive Form Fragment

  3. Specify title, name, description, and tags for the fragment. Ensure that you specify a unique name for the fragment. If another fragment exists with the same name, the fragment fails to create.

  4. Select a form template. You can create a form fragment for Core Components based Adaptive Forms or Foundation Components based Adaptive Forms. To create form fragment for Core Components based forms, select a Core Components based template.

    When you create form fragment for Core Components based forms, use the Select Form Theme option to select a Core Components based theme.

  5. Click to open the Form Model tab, and from the Select From drop-down menu, select one of the following models for the fragment:

    Displays model type in the Form Model tab

    • None: Specifies to create the fragment from scratch without using any form model.

      NOTE
      In Adaptive Forms, you can use single form fragment (based on Core Components) multiple times. It supports both none-based and schema-based form fragments.
    • Schema: Specifies to create the fragment using an XML or JSON schema uploaded to AEM Forms. You can upload or select from the available XML or JSON schemas as the form model for the fragment. When you select an XML schema, you can also create an Adaptive Form fragment by selecting a complexType present in the selected schema from the XML Schema Complex Type drop-down box. When you select a JSON schema, you can also create an Adaptive Form fragment by selecting a schema definition present in the selected schema from the JSON Schema Definitions drop-down box.

    • Form Data Model: Specifies to create the fragment using a form data model (FDM). You can create an Adaptive Form fragment based on only one data model object in a form data model (FDM). Expand Form Data Model (FDM) Definitions drop-down. It lists all data model objects in the specified form data model(FDM). Select a data model object from the list.

    Form Data Model (FDM)

  6. Click Create and then click Open to open the fragment, with a default template, in edit mode. In edit mode, you can add any Adaptive Form component to the fragment.

Once the Adaptive Form fragment based on a schema or form data model (FDM) is created, form data model (FDM) or schema elements appear in the Data Sources tab of the Content browser in Adaptive Form editor. You can drag-and-drop form-model elements onto the fragment. The added form-model elements are converted to form components while retaining the original properties from the associated schema.

Add a fragment to an Adaptive Form

To add an Adaptive Form fragment to an Adaptive Form:

  1. Open the Adaptive Form in edit mode.

  2. Add the Adaptive Form Fragment component to the form.

  3. Open the Configuration dialog of Adaptive Form Fragment component.

  4. Select the Fragment reference in the Basic tab. All the Adaptive Forms fragments available for your form, depending on the model of the form, appear.

  5. Select an Adaptive Form fragment onto the Adaptive Form Fragment component on your Adaptive Form.

    select the Adaptive Form Fragments option

The Adaptive Form fragment is added by reference to the Adaptive Form and remains in synchronized with the standalone Adaptive Form fragment. This implies that any modifications made to the Adaptive Form fragment are mirrored across all instances where the fragment is incorporated within Adaptive Forms.

Using fragments within fragments

You can create nested Adaptive Form fragments, which means you can add a fragment in another fragment, and can have nested fragment structure.

Using a form fragment multiple times in an Adaptive Form

You can use a none-based and schema-based form fragment multiple times in an Adaptive Form to save data uniquely for each form fragments fields. For example, you can use an address form fragment to collect address details for permanent, communication, and present living addresses in a loan application form.

using multiple fragment in adaptive form

Manage fragments

You can perform several operations on Adaptive Form fragments using the AEM Forms UI.

  1. Go to https://[hostname]/aem/forms.html.

  2. Click Select in the AEM Forms UI toolbar and select an Adaptive Form Fragment. The toolbar displays the following operations you can perform on the selected Adaptive Form fragment.

OperationDescription
EditOpens the selected Adaptive Form fragment in edit mode.
PreviewProvides options to preview the fragment as an HTML or a custom preview by merging data from an XML file with the fragment. For more information, see Previewing a form.
DownloadDownloads the selected fragment.
Start Review/Manage ReviewAllows initiating and managing a review of the selected fragment. For more information, see Creating and managing reviews.
Add DictionaryGenerates a dictionary for localizing the selected fragment. For more information, see Localizing Adaptive Forms.
Publish / UnpublishPublishes / unpublishes the selected fragment.
DeleteDeletes the selected fragment.