I have to pull tags from page properties and add into dialog tagfield while dialog is loading using js.
i wrote below script for the same but its adding single field (last index) not all which are in loop.
if i directly set array without loop, it will show in single field in dialog while loading.
Can someone help me here?
$(document).on("dialog-loaded", function (e) {
let currentPagePath = window.location.pathname.replace("editor.html/","").replace(".html","");
$dialog = e.dialog;
var $dialogContent = $dialog.find(dialogContentSelector);
var dialogContent = $dialogContent.length > 0 ? $dialogContent[0] : undefined;
if (dialogContent) {
retrieveLocationData(currentPagePath);
for (let i = 0; i < locationTags.length; i++) {
$dialog.find(locationsTagsDialog).adaptTo("foundation-field").setValue(locationTags[i]);
}
}
});