diff --git a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v2/form/FormContainerImpl.java b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v2/form/FormContainerImpl.java index ed89546728..41081c2864 100644 --- a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v2/form/FormContainerImpl.java +++ b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v2/form/FormContainerImpl.java @@ -373,4 +373,9 @@ public String getName() { return FormContainer.super.getName(); } + @JsonIgnore + public AutoSaveConfiguration getAutoSaveConfig() { + return autoSaveConfig; + } + } diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/container/v2/container/clientlibs/site/js/formcontainerview.js b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/container/v2/container/clientlibs/site/js/formcontainerview.js index 826fb80cf5..3492e0eaaf 100644 --- a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/container/v2/container/clientlibs/site/js/formcontainerview.js +++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/container/v2/container/clientlibs/site/js/formcontainerview.js @@ -81,7 +81,7 @@ */ #setupAutoSave(formModel) { const autoSaveProperties = formModel?.properties?.['fd:autoSave']; - const enableAutoSave = autoSaveProperties?.['fd:enableAutoSave']; + const enableAutoSave = this.#getAutoSaveAttribute(); if (enableAutoSave) { const autoSaveStrategyType = autoSaveProperties['fd:autoSaveStrategyType']; const autoSaveInterval = autoSaveProperties['fd:autoSaveInterval']; @@ -96,6 +96,10 @@ } } } + + #getAutoSaveAttribute() { + return this.getFormElement()?.getAttribute('data-cmp-auto-save') === 'true'; + } } async function onDocumentReady() { diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/container/v2/container/container.html b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/container/v2/container/container.html index 633e8d2c55..c3fe8f99bd 100644 --- a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/container/v2/container/container.html +++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/container/v2/container/container.html @@ -36,6 +36,7 @@ data-sly-use.templates="core/wcm/components/commons/v1/templates.html" action="${container.metadata.action}" id="${container.id}" + data-cmp-auto-save="${wcmmode.disabled && container.autoSaveConfig && container.autoSaveConfig.enableAutoSave ? 'true' : 'false'}" data-cmp-is="adaptiveFormContainer" data-cmp-context-path="${request.contextPath}" data-cmp-page-lang="${container.containingPageLang}" @@ -61,4 +62,4 @@
- \ No newline at end of file +