May 19, 2020
Estimated Post Reading Time ~

AEM Forms: The Benefit of Reusability

Working in the technology industry we’ve all been in the position where we’ve had to redo part of a project because you forgot to save a file, someone overwrote your assignment, or you’ve had to work with a CMS where you’re constantly having to recreate the same content. The latter would include common elements like the site header, footer, or sidebar. This is where AEM Forms can come in very handy with its ability to create once and use everywhere.

AEM Form Fragments
AEM forms come with an extremely useful feature called form fragments. Form fragments are sections of a form that you can reuse across multiple forms on the site; for example, a signature or an address block. With form fragments, you can create multiple segments and use them throughout your forms.
In this example we will create an address block fragment:

Creating a fragment
  • Click Create > Adaptive Form Fragment.
  • Specify title (Address Block), description (Address block for work), and any necessary tags for the fragment (Optional).
  • Click to open the Form Model tab, and from the Select From the drop-down menu, select the “none” option since we are creating a form fragment from scratch.
NOTE: You can also create a form template using an XDP template (typically imported from LiveCycle) uploaded to AEM Forms.

Save panel as a fragment
  1. Open an adaptive form that contains the panel you want to save as an adaptive form fragment.
  2. In the panel toolbar, click Save as Fragment. The Fragment Creation dialog opens.
  3. Fill in the necessary details for the fragment
  4. Click OK. The panel is saved at the specified or the default location in the repository.
Insert a fragment in an adaptive form
Now that you’ve created a panel as a fragment we can insert it into an adaptive form.
  1. Open the adaptive form in which you want to insert the adaptive form fragment into
  2. Click the Adaptive Form Fragments tab in the AEM content finder. All available adaptive form fragments appear in the tab. Insert the “Address Block” form fragment that we just created into your form.
  3. Drag-and-drop an adaptive form fragment onto an adaptive form that you have already created.
Looking Ahead
Adaptive forms can be a lifesaver when you have hundreds (or thousands) of forms where you want to insert a common element. From our address block example above, you can see that you don’t need to re-create an address block each time you create a form, which is a huge time saver. It’s just one of the many advantages of AEM Forms. Be on the lookout for our next post in our AEM Forms series where we will talk more in-depth about managing assets.


By aem4beginner

No comments:

Post a Comment

If you have any doubts or questions, please let us know.