AnsweredAssumed Answered

InfoWindow formatting

Question asked by cleotokos on Nov 6, 2015
Latest reply on Nov 18, 2015 by cleotokos

Hi all, I'm wondering if there is some way to use some kind of "if" statement in my infowindow. What I want to do is display a field that has a hyperlink, replacing the hyperlink's text with "Click to open" (this is the "WebLink" field below). However some items don't have a hyperlink, so I want to leave it blank in those cases. Here's my template code, which currently places "Click to open" regardless if there is anything in the field or not:

 

var agrTemplate = new InfoTemplate(layerName, "Occupied Status:  ${OCCUPIED} </br> Entry Date:  ${ENTRY_DATE} </br> 
                         Renewal Date:  ${Renew_Date} </br> Contact:  ${CONTACT} \n\</br> 
                         WebLink:  <a href =${WebLink} target='_blank'>Click to open</a> </br> Non-Exclusive:  ${NONEXCL}");
                feature.setInfoTemplate(agrTemplate);

 

Is there some kind of pretest I could do? Such as if WebLink = null, show this template, else show another one? I think there's something I'm just not thinking of here.

Outcomes