Create and use Adaptive Forms Fragments in an Adaptive Form based on Core Components adaptive-form-fragments
While every form is designed for a specific purpose, there are some common segments in most forms, such as to provide personal details like name and address, family details, income details. Form developers are required to create these common segments every time a new form is created.
Adaptive Forms provides a convenient mechanism to create form segment like a panel or a group of fields only once and reuse them across Adaptive Forms. These reusable and standalone segments are called Adaptive Form fragments.
Form fragments seamlessly integrate into multiple forms, streamlining the creation of consistent and professional-looking forms. Form Fragments ensure reusability, standardization, and brand consistency through ‘change once and reflect everywhere’ functionality. Experience greater maintainability and efficiency as updates made in one place are automatically propagated across all forms that utilize these fragments.
You can add a fragment multiple times to a document and use data binding properties of its components to tie it to different data sources or schema. For example, you can use the same address fragment for permanent, communication, and billing address and connect it to different fields of a data sources or schema.
Create an Adaptive Form Fragment create-a-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:
-
Log in to your AEM Forms instance at https://[hostname]:[port]/aem/forms.html.
-
Click Create > Adaptive Form Fragment.
-
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.
-
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.
-
Click to open the Form Model tab, and from the Select From drop-down menu, select one of the following models for the fragment:
-
None: Specifies to create the fragment from scratch without using any form model.
note note 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.
-
-
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 insert-a-fragment-in-an-adaptive-form
To add an Adaptive Form fragment to an Adaptive Form:
-
Open the Adaptive Form in edit mode.
-
Add the Adaptive Form Fragment component to the form.
-
Open the Configuration dialog of Adaptive Form Fragment component.
-
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.
-
Select an Adaptive Form fragment onto the Adaptive Form Fragment component on your Adaptive Form.
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 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 using-form-fragment-mutiple-times-in-af
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.
Manage fragments manage-fragments
You can perform several operations on Adaptive Form fragments using the AEM Forms UI.
-
Go to
https://[hostname]/aem/forms.html
. -
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.
Key points to remember when working with fragments key-points-to-remember-when-working-with-fragments
- Ensure that the fragment name is unique. The fragment fails to create if there is an existing fragment with the same name.
- Any expression, script, or style in a stand-alone Adaptive Form fragment is retained when it is inserted by reference or embedded in an Adaptive Form.
- You cannot edit an Adaptive Form fragment, which is inserted by reference, from within an Adaptive Form. To edit, modify the stand-alone Adaptive Form fragment.
- When you publish an Adaptive Form, you need to publish the standalone Adaptive Form fragments inserted by reference in the Adaptive Form.
- When you republish an updated Adaptive Form fragment, the changes reflect in the published instances of the Adaptive Form in which the fragment is used.
- Adaptive Form containing the Verify component does not support anonymous users. Also, it is not reommended to use the Verify component in an Adaptive Form fragment.
Reference Fragments reference-fragments
Reference Adaptive Form fragments that you can use to create your form are available.
See Also see-also
- Create an AEM Adaptive Form
- Add an AEM Adaptive Form to the AEM Sites page
- Apply themes to an AEM Adaptive Form
- Add components to an AEM Adaptive Form
- Use CAPTCHA in an AEM Adaptive Form
- Generate a PDF version (DoR) of an AEM Adaptive Form
- Translate an AEM Adaptive Form
- Enable Adobe Analytics for an Adaptive Form to track form usage
- Connect Adaptive Form to Microsoft SharePoint
- Connect Adaptive Form to Microsoft Power Automate
- Connect Adaptive Form to Microsoft OneDrive
- Connect Adaptive Form to Microsoft Azure Blob Storage
- Connect Adaptive Form to Salesforce
- Use Adobe Sign in an AEM Adaptive Form
- Add a new locale for an Adaptive Form
- Send Adaptive Form data to a database
- Send Adaptive Form data to a REST endpoint
- Send Adaptive Form data to AEM Workflow
- Use Forms Portal to list AEM Adaptive Forms on an AEM website
- Add versionings, comments, and annotations to an Adaptive Form
- Compare Adaptive Forms