Skip to content

Commit

Permalink
FORMS-16201 Register auto save in publish(disabled) mode only
Browse files Browse the repository at this point in the history
  • Loading branch information
girotraapankaj committed Sep 19, 2024
1 parent e1a2739 commit 4867f5d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,12 @@ public String getRedirectUrl() {
return redirectURL;
}

@JsonIgnore
@Nullable
public AutoSaveConfiguration getAutoSaveConfig() {
return autoSaveConfig;
}

@JsonIgnore
@Nullable
public String getPrefillService() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
Expand All @@ -96,6 +96,10 @@
}
}
}

#getAutoSaveAttribute() {
return this.getFormElement()?.getAttribute('data-cmp-auto-save') === 'true';
}
}

async function onDocumentReady() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand All @@ -61,4 +62,4 @@
</div>
</form>
<div data-cmp-adaptiveform-container-loader="${container.id}"></div>
</sly>
</sly>

0 comments on commit 4867f5d

Please sign in to comment.