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

Request for Information: How to Retrieve a Component’s Value in AEM Core Forms

Open gianni147 opened this issue 7 months ago • 1 comments

We're currently migrating from AEM Foundation Forms Components to AEM Core Forms Components. We have a custom “Label Value” component that needs to retrieve values from other components. In Foundation Forms, we accessed these values using guidelib.runtime[fieldName], but now we want an equivalent approach in AEM Core Forms.

After exploring guideBridge, we did find a working solution, but it’s difficult to maintain. For example, we already know the field name, we search for it by navigating through:

window.guideBridge?.getFormModel?.().items[0].items[0].items[0]._jsonModel.name If that matches, we then retrieve the value from:

window.guideBridge?.getFormModel?.().items[0].items[0].items[0]._jsonModel.value We have multiple panels (some are repeatable), so we need to check if the panel name matches what the author entered, locate the correct panel array index, and then match the field name to ultimately get something like:

window.guideBridge?.getFormModel?.().items[0].items[1].items[3]._jsonModel.value Doing all of this is not easy, and we plan to add more functionality—like setting an optionbindref for pre-fill and updating values when users select certain options.

Because of these complexities, we’d like to know if there’s any out-of-the-box functionality, or at least a simpler pattern or API, for reliably retrieving and modifying these values without manually navigating through the window.guideBridge?.getFormModel? structure.

gianni147 avatar Mar 04 '25 14:03 gianni147