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.
You can configure an adaptive form to automatically start saving the content based on an event or a pre-defined time-interval. By default, contents of an adaptive form are saved on a user action, such as on pressing the save button. The auto save option is helpful in:
For an adaptive form, the auto save option is not enabled out of the box. You can enable the auto save option from the Auto Save section in the properties of an adaptive form. The Auto Save section also provides several other configuration options. Perform the following steps to enable and configure the auto save option for an adaptive form:
To access the auto-save section in the properties, select a component, then tap > Adaptive Form Container, and then tap
.
In the Auto Save section, Enable the auto-save option.
In the Adaptive Form Event box, specify 1 or TRUE to automatically start saving the form when the form is loaded in the browser. You can also specify a conditional expression for an event, which when triggered and returns true, starts saving the content of the form.
Specify the Trigger. Auto-save is triggered based on your configuration. Your options are:
When you select a trigger, Strategy Configuration box is enabled. Strategy Configuration box lets you:
You can also create and add your own custom strategy to the list. For details, see Implement a custom strategy to autosave the forms.
(Time-based autosave only) Perform the following steps to configure options for the Time-based autosave.
(Event-based auto save only) Perform the following steps to configure options for Event-based auto save.
(Optional) To automatically save the content for anonymous users, select the Enable Autosave for anonymous users option, and click OK.
For auto save option to work for anonymous users, ensure that you configure the Forms Common Configuration Service to allow all users to preview, verify, and sign forms.
To configure the service, go to AEM Web Console configuration at https://server:port/system/console/configMgr
and edit the Forms Common Configuration Service to choose the All Users option in the Allow field, and save the configuration.
You can implement a custom event to trigger the autosave functionality. Perform the following steps to create and implement the custom event:
Create client library and client library folders. For detailed steps, see the Using Client-Side Libraries document.
For example, the following script uses the custom emailFocusChange
event to trigger the autosave functionality:
window.addEventListener("bridgeInitializeStart", function (){
guideBridge.connect(function () { guideBridge.on("elementFocusChanged", function (event,data) {
if(data.target.name === 'Email') {
guideBridge.trigger("emailFocusChange");
}
});
});
});
A category property is defined while creating the client library folders. Keep the value assigned to category property handy.
Open the adaptive form in author mode.
In the edit mode, select a component, then tap > Adaptive Form Container, and then tap
.
In th properties, open the Basic section. In the Client Library Category box, enter the value of the category property defined while creating the client library folders.
Open the Auto Save section. In the Auto save after this event box, specify a custom event already defined in the client library. Click OK.