Best practices for working with adaptive forms
Adobe Experience Manager (AEM) forms can help you transform complex transactions into simple, delightful digital experiences. However, it requires concerted effort to implement, build, execute, and maintain an efficient and productive AEM Forms ecosystem.
This document provides guidelines and recommendations that forms administrator, authors, and developers can benefit from when working with AEM Forms, especially adaptive forms component. It discusses best practices right from setting up a forms development project to configuring, customizing, authoring, and optimizing AEM Forms. These best practices collectively contribute to the overall performance of AEM Forms ecosystem.
In addition, here are some recommended reads for general AEM best practices:
Set up and configure AEM Forms
Setting up forms development project
A simplified and standardized project structure can significantly reduce development and maintenance efforts. Apache Maven is an open source tool recommended for building AEM projects.
- Use Apache Maven aem-project-archetype to create and manage structure for AEM project. It creates recommended structure and templates for your AEM project. Also, it provides build automation and change control systems to help manage the project.
- Use the maven archetype:generate command to generate the initial structure.
- Use maven eclipse:eclipse command to generate the eclipse project files and import the project into eclipse.
For more information, see How to Build AEM Projects using Apache Maven .
- The FileVault tool or VLT helps you map the content of a CRX or AEM instance to your file system. It provides change control management operations, such as check-in and check-out of the AEM project content. See How to use the VLT Tool .
- If you use Eclipse-integrated development environment, you can use AEM Developer tools for seamless integration of Eclipse IDE with AEM instances to create AEM applications. For details, see AEM developer tools for Eclipse .
Customizing adaptive forms and components
- AEM Forms provides out-of-the-box adaptive form templates that you can use to create adaptive forms. You can also create your own templates. AEM provides static and editable templates.
- Static templates are defined and configured by developers.
- Editable templates are created by authors using template editor. The template editor lets you define a basic structure and initial content in a template. Any modification in the structure layer is reflected in all forms using that template. The initial content may include pre-configured theme, prefill service, submit action, and so on. However, these settings can be modified for a form using the form editor. For more information, see Adaptive form templates .
- For styling a specific field or panel instance, use inline styling . Alternatively, you can define a class in a CSS file and specify the class name in the CSS Class property of the component.
- Include a client library in a component to consistently apply styles across adaptive forms or fragments that use that component. For more information, see Create an adaptive form page component .
- Apply styles defined in a client library to select adaptive forms by specifying the path to the client library in the CSS file path field in the adaptive form container properties.
- To create a client library of your styles, you can configure the custom CSS file in the Theme Editor base clientlib or in the Form Container properties.
- Adaptive forms provide panel layouts, such as responsive, tabbed, accordions, and wizard, to control how form components are laid out in a panel. You can create custom panel layouts and make them available for use by form authors. For more information, see Creating custom layout components for adaptive forms .
- You can also customize specific adaptive form components like fields and panel layout.
- See Handling personally identifiable information for recommendations on handling PII data.
Prepare forms project for production
Adding forms processing server
You can configure an additional instance of AEM Forms server that resides behind the firewall in a secured zone. You can use this instance for:
- Batch processing : jobs that are recurring or scheduled in batches with heavy load. For example, printing statements, generating correspondences, and using document services like PDF Generator, Output, and Assembler.
- Storing PII data : Save PII data on the processing server. It is not required if you are already using custom storage provider for storing PII data.
Moving project to another environment
You often need to move your AEM projects from one environment to another. Some of the key things to remember when moving are as follows:
- Take backup of your existing client libraries, custom code, and configurations.
- Deploy product packages and patches manually and in the specified order in the new environment.
- Deploy project-specific code packages and bundles manually and as a separate package or bundle on the new AEM server.
- ( AEM Forms on JEE only ) Deploy LCAs and DSCs manually on Forms Workflow server.
- Use Export-Import functionality to move assets to the new environment. You can also configure the replication agent and publish the assets.
Some best practices to configure AEM to improve the overall performance are as follows:
- Cache all client libraries at /etc.clientlibs/fd and any additional custom client libraries on AEM dispatcher to increase the responsiveness and security of your published forms. For more information, see Dispatcher .
- Do not cache /content/forms/af/ and /content/dam/formsanddocuments/* paths. for detailed information about configuring adaptive forms caching, see Caching adaptive forms .
- Enable HTML via web server compression module. For more information, see Performance tuning of AEM Forms server .
- Increase calls per request configuration for large forms. See Optimizing performance of large and complex forms .
- Secure AEM Forms server.
- Use nosamplecontent run mode to ensure there are no sample content and sample users deployed on the production server. See Running AEM in Production Ready Mode .
- Keep the heap size to a minimum of 8 GB. For other settings, see Performance tuning of AEM Forms server .
- Use service user sessions instead of admin sessions for executing service-level tasks. For more information, see Service authentication .
Configuring external storage for drafts and submitted forms data
In a production environment, it is recommended not to store submitted form data in AEM repository. The default implementation of Forms Portal Store, Store Content, and Store PDF submit actions store form data in AEM repository. These submit actions are meant only for demonstration purposes. Also, the Save and Resume and Auto Save features use portal storage by default. Therefore, consider the following recommendations:
- Storing draft data : If you are using the Draft feature of adaptive forms, you should implement a custom Service Provide Interface (SPI) to store draft data in more secure storage like database. For more information, see Sample for integrating drafts & submissions component with database .
- Storing submission data : If you are using Form Portal Submit Store, you should implement a custom SPI to store submission data in a database. See Sample for integrating drafts & submissions component with database for a sample integration.You can also write a custom submit action that stores form data and attachment in secure storage. See Writing custom Submit action for adaptive forms for more information.
Handling personally identifiable information
One of the key challenges for organizations is how to handle personally identifiable (PII) data. Some best practices that will help you handle such data are as follows:
- Use a secure, external storage like database to store data from draft and submitted forms. See Configuring external storage for drafts and submitted forms data .
- Use Terms and Conditions form component to take explicit consent from user before enabling auto save. In this case, enable auto save only when user agrees to the conditions in Terms and Conditions component.