Hi all,
I would like to add a link to my popupTemplate. The Map Service I am using has an attribute table with it. The attribute table has a field called "Online" that links to a specific webpage containing information about the shape clicked. How can I make that field a hyperlink in my popupTemplate? Here is how I thought it should be done:
var BRADCADpopup = {
title: "2016 BRADCAD Parcels",
content: "<b>{Situs}</b><br>" +
"<a href=\"{Online}\">Appraisal Details</a>"
};
When I click on the hyperlink in the popup, I get a "Potentially dangerous Request.Path value was detected"
Solved! Go to Solution.
Thank Rickey! I realized my error was I was trying to add "" around my link's href attribute. I noticed you didn't have quotations around yours, so I dumped mine and it worked like a charm.
this is how I do it
var template = new esri.InfoTemplate("${First_Name} ${Last_Name} ", "<a href=http://Mylocation/cemetery/${Photo_loc} target='_blank'> <img src=${Photo_loc} WIDTH=150 HEIGHT=150></a> <br/> <b>Last Name:</b> ${Last_Name} <br/><b> First Name:</b> ${First_Name}<br/><b> Cemetery:</b> ${Cemetery}<br/> <b>Section:</b> ${Section}<br/> <b>Block: </b>${Block}<br/> <b>Lot:</b> ${Lot}<br/> <b>Space:</b> ${Space}<br/> <b>Age:</b> ${Age}<br/> <b>Date of Birth: </b>${Date_of_Birth}<br/> <b>Birth City:</b> ${Birth_Citys}<br/><b> Birth State:</b> ${Birth_State}<br/> <b>Birth Country:</b> ${Birth_Country}<br/><b> Date of Death: </b>${Date_of_Death}<br/> <b>Death State:</b> ${Death_State}<br/><b> Death City: </b>${Death_City}<br/> <b>Spouses Name: </b>${Spouses_Name}<br/> <b>Undertaker:</b> ${Undertaker}<br/> <b>Year of Birth:</b> ${Year_of_Birth}<br/> <b>Personal Notes:</b> ${Personal_Notes}");
feature.setInfoTemplate(template);
Thank Rickey! I realized my error was I was trying to add "" around my link's href attribute. I noticed you didn't have quotations around yours, so I dumped mine and it worked like a charm.
I'm not sure you're allowed to do this as it presents a security concern. There may be a way around it if you keep poking around though.
One way to get similar behavior is to add an action to your popupTemplate.
Something like this: JS Bin - Collaborative JavaScript Debugging
In that example, clicking on the action in the popup fires a function that looks at the feature in the open popup, takes its "Online" field from its attributes, and opens a new tab.