Adobe recommends using the modern and extensible data capture Core Components for creating new Adaptive Forms or adding Adaptive Forms to AEM Sites pages. These components represent a significant advancement in Adaptive Forms creation, ensuring impressive user experiences. This article describes older approach to author Adaptive Forms using foundation components.
AEM Forms allows form developers to seamlessly embed adaptive forms and Interactive Communications in an AEM Sites Single Page Application (SPA). The embedded adaptive form and Interactive Communication is fully functional and users can fill and submit the form without leaving the page. It helps user remain in context of other elements on the web page and simultaneously interact with the adaptive form or Interactive Communication.
In AEM Sites Single Page Application, you can add an adaptive form or Interactive Communication using the AEM Forms SPA Container component. It is an AEM Forms component for AEM Sites SPAs that you can add to your Sites page.
For information about embedding an adaptive form in a non-SPA AEM Sites, see Embed an adaptive form or interactive communication in AEM Sites page.
To embed an adaptive form or Interactive Communication in an AEM sites SPA using the AEM Forms SPA Container component, ensure that you have installed:
Execute the following steps install the AEM Forms SPA Container component:
Install the AEM Forms component for SPA. The instructions to install the component are available in the README.md file.
The component includes a sample React component that can be used to integrate SPA container component with a React-based SPA project.
Integrate SPA container component with a React-based SPA project using the instructions available in the README.md file.
After installing the AEM Forms SPA Container component and integrating the component with a React-based SPA project, you can embed an adaptive forms and Interactive Communications in the AEM Sites page.
To embed an adaptive form or Interactive Communication using AEM Forms for SPA Container component:
Open the AEM sites page, in edit mode, in which you want to embed an adaptive form or Interactive Communication.
Insert the AEM Form for SPA component on the page using any of the following options:
Tap the layout container on the Sites page, tap + and select the AEM Form for SPA component.
From the Component browser panel, drag-drop the AEM Form for SPA component on the page.
Search for an adaptive form or Interactive Communication in the Assets browser and drag-drop it onto the Sites page. It embeds the form in an AEM Forms for SPA component container.
Rendering multiple AEM Forms SPA Container components on a page are not supported. You can have multiple AEM Forms SPA Container on a page but only one component is rendered at a time. Ensure that only one component is visible on a page to avoid discrepancies.
Tap the embedded AEM Forms SPA Container component in the sites page, and then tap on the action bar. The Edit AEM Forms SPA Container dialog opens.
In the Edit AEM Forms Container dialog, specify the following:
Asset Type: Select the type of asset to embed. The options are Adaptive Form and Interactive Communication
Asset Path: Browse and select the adaptive form or Interactive Communication to embed. The field is auto-populated if an adaptive form or Interactive Communication is inserted using the Assets browser.
Channel (Interactive Communication Only): Select the type of interactive channel to embed. The options are Web Channel and Print Channel.
Theme: Select a theme that defines styling for components of your adaptive form or Interactive Communication. Styling includes appearance properties such as font style, background color, dimensions, and alignment.
Tap to save the settings. The adaptive form or Interactive Communication is now embedded in the page.
Consider the following scenarios for publishing an embedded asset (adaptive form or Interactive Communication) on AEM Sites page:
AEM sites page maintains a reference to the adaptive form and Interactive Communication in the AEM Forms Container. Therefore, all configurations and properties, such as the theme, styles, and submit action, configured in the original adaptive form and Interactive Communication are retained in the embedded adaptive form and Interactive Communication.
To modify any configuration or property of the embedded adaptive form and Interactive Communication, do one of the following.
Do keep the following points in mind when embedding adaptive forms in AEM sites pages: