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.
Miss the first article in our AEM Forms series? Learn about the technology and architecture of AEM Forms in part 1.
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 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
- Open an adaptive form that contains the panel you want to save as an adaptive form fragment.
- In the panel toolbar, click Save as Fragment. The Fragment Creation dialog opens.
- Fill in the necessary details for the fragment
- 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.
- Open the adaptive form in which you want to insert the adaptive form fragment into
- 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.
- Drag-and-drop an adaptive form fragment onto an adaptive form that you have already created.
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.
If you’re in the process of optimizing or implementing your AEM solution, we can help. Reach out to our team today.