I am stuck using the Map Viewer Classic because a group I work with requires it and isn't budging. I'm trying to get an Arcade expression to produce HTML and present it in the popup, but the popup is escaping the HTML and displaying the source code. I have a layer in a webmap with a popup configured like this:
Clicking on the "CONFIGURE" button, my popup looks like this:
As you can see above, I've used the editor's bold button to create bold font, which is configuring HTML for the popup. But I also need my Arcade expressions to produce some HTML formatting. Here is the code for expression/expr0. The code receives a JSON dictionary from the field and formats it as a bulleted list in HTML.
var popup = '<ul>\n'
var fieldDict = Dictionary($feature["Field_Offices"]);
for (var sid in fieldDict) {
Console('Inside Level loop')
var record = fieldDict[sid];
popup += `<li>${sid}: ${record['office_name']}\n`;
}
popup += '</ul>\n'
return popup
The code is producing all the values I want, but the popup is escaping the HTML tags, so it shows the HTML source, rather than rendering the bulleted list:
How do I make this popup render the HTML?
Bonus question: The Console() function works great in the new map viewer, but does absolutely nothing in Map Viewer Classic (it's in my expression, above). Is there a trick to get that to log to the developer tools console?