Select to view content in your preferred language

How to make clickable link for the web address , and show Just unknown for Route URL field , in the pop- up - arcgis online web map

136
1
11-04-2024 09:19 AM
kalpanag
New Contributor

Hi everyone, 

   I am trying to make customizable pop-up to show data to the public. here i have filed name route url, that has links for some of the routes, put unknown for some of  routes. now in the pop-up i would like to show the clickable links without showing text for  (web address), and show Unknown without clickable link.

it would be very helpful to me if you assist me here. 

kalpanag_0-1730740650144.png

image_1.PNG

 

0 Kudos
1 Reply
ChristopherCounsell
MVP Regular Contributor

Create an attribute expression in the pop-up. Modify the below so it says your field name.

var urlField = $feature["YourFieldName"];

// Replace with your actual field name

if (urlField == "unknown" || IsEmpty(urlField)) {
return "Unknown";
} else {
return "<a href='" + urlField + "' target='_blank'>" + "Click here" + "</a>";
}

Then add the expression to your popup like 

ROUTE URL: {expression/expr0}

It will show text 'unknown' or a hyperlink 'Click here'

0 Kudos