Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.

How to add values in Touch UI Component multifield field from a array response of a ajax call in AEM 6.2 ?

Avatar

Level 3

Hi All,

I'm able to add an Array values into AEM 6.2 Classic UI Component dialog Multifield field using listeners node click function, below is the code snippet

function(comp, evt) { var form = this.findParentByType('form'); var arpitField = form.find('name', './arpitMultifield')[0]; if (arpitField) { arpitField.setValue(); } var responseArray = []; var requestParams = {}; var url = "/bin/arpitServletCall/data.json"; requestParams.type = 'name'; requestParams.values = "Arpit"; var appi = $.ajax({ type: "GET", url: url, data: requestParams, async: false, success: function(response) { for (var property in response) { responseArray.push(property + " : " + response[property]); } } }); for (var i = 0; i < responseArray.length; i++) { /* setting field */ var value = responseArray[i]; arpitField.addItem(value); } }

above "arpitMultifield" is Classic UI "xtype=multifield" and "responseArray" is the response I'm getting after ajax call in array format like below:

[ "id : 22", "firstName : Arpit", "lastName : Bora", "email : arpit.p.bora@gmail.com" ]

Using for loop I'm iterating array and adding values in the multifield field using "arpitField.addItem(value)".
 

Now I'm trying the same for AEM 6.2 Touch UI Component dialog multifield (granite/ui/components/foundation/form/multifield) using clientlib "listeners.js" because listeners node is not working in Touch UI dialog, I referred this article https://helpx.adobe.com/experience-manager/using/creating-touchui-events.html.

I'm able to write click logic and call ajax but the only problem is how to store ajax response array values into the multifield field in Touch UI dialog.

 

Please provide your suggestion and answers.

Thanks,

Arpit Bora

0 Replies