adobe / adobe/aem-core-forms-components

Info request: how to update submitted form data?

Open
#1,527 1 comment 0 reactions 0 assignees View on GitHub
answered
Dominant language
JavaScript
Stars
36
Forks
62
Avg merge
1d 6h
Merged PRs (30d)
8

Description

We are currently migrating from AEM Foundation Forms Components to AEM Core Forms Components. We have a URL query param which should be inserted in the submitted form data json. To achieve this I created a custom javascript function which I call from within the rule editor. In this function I then try to update the form data.

I have found a working solution after deep-diving into the source code:
`
var param = new URLSearchParams(window.location.search).get('....');
window.guideBridge.getFormModel().importData(Object.assign({}, window.guideBridge.getFormModel().getDataNode().$value,
{afUnboundData: {data: {"param": param}}})
)
`

But this is far from straightforward. Is there a better way to achieve this? Normally there is, for example, the setData() function on guideBridge (I believe) but that doesn't work for core components. Is there a core components variant to easily add something to the json data?
Thanks!

Contributor guide

Open the contributing guide

Research direction

Start with the Core Forms Components guideBridge integration and compare the mentioned setData() path with getFormModel().importData(). Verify whether a supported API can add a URL query parameter to submitted JSON without relying on direct model internals; done is a documented answer or a clearly scoped API change.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.