Skip to content

Commit d1005a3

Browse files
FORMS-16201 Register auto save in publish(disabled) mode only
1 parent e1a2739 commit d1005a3

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v2/form/FormContainerImpl.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,4 +373,9 @@ public String getName() {
373373
return FormContainer.super.getName();
374374
}
375375

376+
@JsonIgnore
377+
public AutoSaveConfiguration getAutoSaveConfig() {
378+
return autoSaveConfig;
379+
}
380+
376381
}

ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/container/v2/container/clientlibs/site/js/formcontainerview.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
*/
8282
#setupAutoSave(formModel) {
8383
const autoSaveProperties = formModel?.properties?.['fd:autoSave'];
84-
const enableAutoSave = autoSaveProperties?.['fd:enableAutoSave'];
84+
const enableAutoSave = this.#getAutoSaveAttribute();
8585
if (enableAutoSave) {
8686
const autoSaveStrategyType = autoSaveProperties['fd:autoSaveStrategyType'];
8787
const autoSaveInterval = autoSaveProperties['fd:autoSaveInterval'];
@@ -96,6 +96,10 @@
9696
}
9797
}
9898
}
99+
100+
#getAutoSaveAttribute() {
101+
return this.getFormElement()?.getAttribute('data-cmp-auto-save') === 'true';
102+
}
99103
}
100104

101105
async function onDocumentReady() {

ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/container/v2/container/container.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
data-sly-use.templates="core/wcm/components/commons/v1/templates.html"
3737
action="${container.metadata.action}"
3838
id="${container.id}"
39+
data-cmp-auto-save="${wcmmode.disabled && container.autoSaveConfig && container.autoSaveConfig.enableAutoSave ? 'true' : 'false'}"
3940
data-cmp-is="adaptiveFormContainer"
4041
data-cmp-context-path="${request.contextPath}"
4142
data-cmp-page-lang="${container.containingPageLang}"
@@ -61,4 +62,4 @@
6162
</div>
6263
</form>
6364
<div data-cmp-adaptiveform-container-loader="${container.id}"></div>
64-
</sly>
65+
</sly>

0 commit comments

Comments
 (0)