aem-core-forms-components icon indicating copy to clipboard operation
aem-core-forms-components copied to clipboard

Info request: how to update submitted form data?

Open GeetsM opened this issue 9 months ago • 1 comments

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!

GeetsM avatar Feb 11 '25 14:02 GeetsM