[Portal 10.9.1] [Arcade expression]
Hello, i added this html code to customize the pop up windows in a Portal app :
<strong>Email : </strong><a href="mailto:{mail}">contact mail</a>
but i figured i had several blank fields (' ') in my Email column... so it result a link wich open outlook but with no email adress
So i tried to fix this with an Arcade expression but the result is not really what i need because it return a link even if the email field is null.
var mail = $feature.email;
if (mail == ' ') {
mail = 'no email adress';
}
return mail;
I know the solution would be to create my link in an other Arcade expression but it seems i'm not able to find out the solution.
The thing i would like is using Arcade to return an hyperlink (mailto: for email) if field is not null
May someone help me with this please ?
Many thanks
Dave
Solved! Go to Solution.
A standalone Arcade expression will only return a string, so if you try to include HTML tags, you'll get the literal text "<a href=mailto...>", etc.
To get Arcade to return items that respect HTML tags, you need to use an actual Arcade element in your popup, which is unfortunately not available at 10.9.1.
One way around this is to use an expression to check the presence of an email address, and use that expression to control the visibility on a <div> in your popup text. Here's a relevant post from @JohannesLindner : https://community.esri.com/t5/arcgis-online-questions/using-arcade-or-html-to-hide-display-hyperlink...
The expression could be as simple as:
iif($feature.email == ' ', 'none', 'block')
And the popup formatting (remember to click "show source" first):
<div style="display:{expression/email_visibility}">
<strong>Email : </strong><a href="mailto:{email}">contact mail</a>
</div>
Hello KenBuja,
Thanks for your answer.
The field is not null or empty... there is a space in it. My arcade expression work like this but my problem is to generate a mailto link only if i got an email adress.
A standalone Arcade expression will only return a string, so if you try to include HTML tags, you'll get the literal text "<a href=mailto...>", etc.
To get Arcade to return items that respect HTML tags, you need to use an actual Arcade element in your popup, which is unfortunately not available at 10.9.1.
One way around this is to use an expression to check the presence of an email address, and use that expression to control the visibility on a <div> in your popup text. Here's a relevant post from @JohannesLindner : https://community.esri.com/t5/arcgis-online-questions/using-arcade-or-html-to-hide-display-hyperlink...
The expression could be as simple as:
iif($feature.email == ' ', 'none', 'block')
And the popup formatting (remember to click "show source" first):
<div style="display:{expression/email_visibility}">
<strong>Email : </strong><a href="mailto:{email}">contact mail</a>
</div>
Hello jcarlson,
It works perfectly ! Many thanks.
Hi @jcarlson !
I am currently working within Portal 10.9.1 and am not finding something for this workaround.
You say:
@jcarlson wrote:And the popup formatting (remember to click "show source" first):
I cannot find "Show Source". Are you seeing this in a popup within the NEW Web Map in 10.9.1?
Thanks,
Adam