Configuring lazy loading
Perform the following steps to enable lazy loading on an adaptive form fragment:
-
Open the adaptive form in authoring mode that contains the fragment you want to enable for lazy loading.
-
Select the adaptive form fragment and tap
-
In the sidebar, enable Load fragment lazily and tap Done.
The fragment is now enabled for lazy loading.
You can mark the values of objects in the lazily loaded fragment as global so that they are available for use in scripts when the containing fragment is not loaded. Do the following:
-
Open the adaptive form fragment in authoring mode.
-
Tap the field whose value you want to mark as global, and then tap
-
In the sidebar, enable Use value during lazy loading.
The value is now marked as global and will be available for use in scripts even when the containing fragment is unloaded.
Considerations and best practices for configuring lazy loading
Some limitations, recommendations, and important points to keep in mind when working with lazy loading are as follows:
- It is recommended to use XSD schema-based adaptive forms over XFA-based adaptive forms for configuring lazy loading on large forms. The performance gain due to lazy loading implementation in XFA-based adaptive forms is relatively less than gain in XSD-based adaptive forms.
- Do not configure lazy loading on fragments in a responsive grid layout. It can result in degraded performance.
- It is recommended not to configure lazy loading on fragments in the first panel that renders on loading the adaptive form.
- Lazy loading is supported up to two levels in the fragment hierarchy.
- Ensure that fields marked as global are unique across an adaptive form.
- Consider writing visibility rules for fragments that should show or hide based on a condition. For example, you can show or hide the Spouse Details fragment based on the marital status specified by a user.
- File attachment and Terms and conditions components are not supported in lazily loaded fragments.
Scripting best practices for configuring lazy loading
Important points to keep in mind while developing scripts for lazy loading panels are as follows:
-
Ensure that initialize and calculate scripts used on the fields of a lazy loaded fragment are are idempotent in nature. Idempotent scripts are those which have same effect even after multiple executions.
-
Use the globally available property of fields to make value of fields located in a lazy loading panel available to all other panels of a form.
-
Do not forward reference value of a field inside a lazy panel irrespective of field being marked globally across fragments or not.
-
Use panel reset feature to reset everything visible on the panel by using the following click expression.
guideBridge.resolveNode(guideBridge.getFocus({“focusOption”: “navigablePanel”})).resetData()