Hi all,
we are using a popup for one of our features with a FieldsContent.
We are using an arcade expression for one of the fields. The expression returns a url calculated with a concatenated string.
It was a positive surprise that the API understands that it is a hyperlink and it creates an anchor element with the text "View" at the popup. The users can click on the anchor element and a new tab opens with the link.
We have a new request from our customer to change the text "View" on the hyperlink to whatever we want.
Is this possible?
We tried to use arcade to return an anchor element correctly structured but with no luck.
Any ideas are welcome!
Here's an Esri blog post that shows how you can do exactly that! Arcade is amazing, ha.
Hi Rene,
thanks for the fast reply! I could not find an answer to neither part 1 (nor part 2) of the blog post above (nice read though 😉 ).
In our case, we have a popup with a fieldContent shown for a feature. The arcade expression for one of the fields is something like that:
return 'https://test.com/' + $feature.ID
The result on the popup looks like that:
After inspecting the element, the value of this field is, magically, an anchor element with href the concatenated link above, and the word "View" as text. It's a welcome behavior actually!
Our question is:
Is there anyway to change the default value "View" somehow?
Could we return an anchor element as the value of a field ?
Can you change the expression to something like this?
var myUrl = 'https://test.com/' + $feature.ID
return `<a href="${myUrl}">Click to learn more.</a>`
yeap, we did that:
I can see a workaround, create a custom content that returns a table element (or returns a widget) with the proper structure for the whole FieldsContent. It's kind of an overkill, just for one attribute to generate a custom popup content. If there is no other way, we might go for that but I think it should be feasible with arcade somehow!