Select to view content in your preferred language

Link not displaying in conditional field display

4580
16
Jump to solution
09-20-2017 09:25 AM
JaredPilbeam1
Deactivated User

Thanks to this recent blog post: https://community.esri.com/community/gis/web-gis/arcgisonline/blog/2017/07/18/conditional-field-disp... 

I have a bunch of points on my web map that are tourist attractions. Some have websites available, some do not. But, they're all in the same attribute table. I have a "URL" field, and when relevant there's a url to the website. This is where the post came in handy. I was able to copy the conditional Arcade line and HTML code that I tailored to my app.

The only thing is that my attribute field is dealing with a link. It's currently showing up as text on the pop-up (visible in the background here). It doesn't seem to be a case of using the link tool in the Custom Attribute Display window because most are individual links. Would you have an idea how to configure it so the link is live?

0 Kudos
1 Solution

Accepted Solutions
JaredPilbeam1
Deactivated User

Hi Robert,

After talking with Esri, I found out there was an existing bug behind this behavior:

BUG-000106245: When using a custom attribute display pop-up with a hyperlink field, null values in the hyperlink field result in a link to the current web map.

This was supposedly fixed at the latest release of AGOL they say. The behavior I'm experiencing with the text appearing in the pop-up for fields with null values, even though the Arcade expression tells it otherwise is a new defect. So, they're looking into it. It sounds like, once treated, the URL field will display the hyperlink when present and nothing when the field's null, thereby eliminating the need for the Arcade expression.

View solution in original post

16 Replies
RobertScheitlin__GISP
MVP Emeritus

Jared,

   It should be as simple as adding a HTML Anchor element to your last line in the Custom Attribute Display dialog.

{expression/expr0} <a href='{URL}' target='_blank'>your link text</a>
JaredPilbeam1
Deactivated User

Robert,

Thanks for the reply.

Sorry, I don't know any HTML. I put your line in and at first it seems like everything was good. I checked some pop-ups that would have a website in the attributes and the link brought me to the right website. But, now the link is showing up on pop-ups of the same attribute table that do not have any websites. So, when you click on the link it brings you back to the web map on a new tab. Also, there's still the text for the link in the pop-up that's not active--not sure how to remove it (see screen shot below).

Here's the whole code:

<table cellpadding="0px" cellspacing="3px">
     <tbody>
           <tr valign="top">
               <td><b>Name:</b></td>
               <td><span>{NAME}</span> 
               </td>
            </tr>
            <tr valign="top">
               <td><b>Address:</b></td>
               <td>{FAC_ADDY_1}</td>
            </tr>
            <tr valign="top">
              <td><br /></td>
              <td>{CITY_ST_ZIP}</td>
            </tr>
           <tr valign="top">
               <td><b>{/expr0}<a href="{URL}" target="_blank">Website</a>
               </b></td><td>{URL}</td>
           </tr>
      </tbody>
</table>

0 Kudos
JaredPilbeam1
Deactivated User

Was able to remove the unwanted text. I erased URL in the Display window. Just the rest of it to figure out now.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Jared,

   Great. Don't forget to mark this question as answered.

0 Kudos
JaredPilbeam1
Deactivated User

Robert,

I'm actually still hung up on one thing. If you look at my first reply to your original reply you'll see there's a problem with the link showing up on pop-ups that do not have a website in the attributes, thus they shouldn't have a link. It's like the problem I was having before I found out about the Arcade conditional expression.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Jared,

   Oh, in that case then the whole

<a href="{URL}" target="_blank">Website</a>

part needs to go in your arcade expression then.

JaredPilbeam1
Deactivated User

Do you mean this, or the part of the HTML that calls the expression? I was pasting it here and there both in the Custom window and in the HTML, but not to the right effect.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

My suggestion would be change what you have in your dialog window above to this:

IIF(IsEmpty($feature.URL), '', '<a href="{URL}" target="_blank">Website</a>‍')
0 Kudos
JaredPilbeam1
Deactivated User

Robert,

Ok, thanks. Now there's a different problem. After putting that line in the Arcade dialog window, the link still appears on the popups that have no website. And whereas before the link on these would bring you to the same web map on a different tab, it now opens a new blank tab.

0 Kudos