Thursday, 8 February 2024

AEM Forms(Forms Fragment)

 Form Fragment

It's similar to how Content Fragments and Experience Fragments allow you to reuse content in various contexts. You can also create Form Fragments to reuse form fields across different forms.

for eg:-



For example, consider a book with two user identities: authors and publishers. Each identity has its own specific form – authors have one form, and publishers have another. However, both forms require the same set of fields to save an address. Instead of creating these address fields separately for each form, we can optimize efficiency by creating a Form Fragment. By doing so, we define the address fields once in the Form Fragment and then reuse it across different forms. This way, we eliminate redundancy and maintain consistency in the structure of address fields, making the development process more streamlined and manageable.

How to create Form Fragment

Step 1: 

  • Navigate to the Adobe Experience Manager (AEM) authoring environment and access the start page.
  • Select "Forms & Documents" from the available options.
  • Within the Forms & Documents section, create a folder to organize all your fragment data. For example, you can create a folder named "Form Fragments" to store your form-related fragments.


Step 2:

  • Navigate to the "Form Fragments" folder within the Adobe Experience Manager (AEM) authoring environment.
  • Create an Adaptive Form Fragment. 
  • For example, let's create a fragment for an address.
  • In the creation process, focus exclusively on the "Basic" tab. Omit the usage of the "Form Data Model" and "Advanced" tabs.
  • Provide a title for the form fragment.
  • For instance, let's name it "Address."
  • Within the "Basic" tab, select the container option and specify the desired path where you want to store your fragment. 
  • For instance, you might choose the path "conf/global" for organizational purposes.


  • you review the process, make sure to include all the necessary address fields when creating the address form fragment.
  •  Ensure that you have selected and added each required field within the "Address" form fragment, and confirm that these fields align with the information you want to capture in the address form.

  • This is your Address Fragment

  • When you open the form and find that you have already added all the necessary fields like Name and Email, but now you want to include address-related fields, navigate to the left-sided asset tab.
  • In the left-sided asset tab, search for the Adaptive Form Fragment section. Here, you will find all the fragments you have previously created.
  • Locate the address form fragment you created earlier and drag it into your form.


  • After adding the address form fragment, you'll notice that your Address panel is present, and all the fields you included when you created the fragment will appear in the form.


No comments:

Post a Comment

Servlet in AEM/Sling Servlet

  What is Servlet? A servlet is a Java class that runs on the server side where the application resides. It acts as a middle layer between t...