Select to view content in your preferred language

Return Value as a Link

563
5
07-17-2012 12:43 PM
CraigMcDade
Occasional Contributor III
Working with the Identify - Popup sample code

Is there a way to configure the returned value as a link?

Example:

var template = new esri.InfoTemplate("", 
    "<b>Station:</b> ${Corner Point Identifier}");


I'd like the Corner Point Identifier to be returned as a link to its individual file.

All the files have the same path except for the Corner Point Identifier + .pdf

Is this possible?
0 Kudos
5 Replies
AustinDavis
New Contributor III
Will coding the return into an anchor tag work?

'<b>Station:</b><a href="http://'+ ${Corner Point Identifier}+'.pdf>Descriptive Text</a>"
0 Kudos
CraigMcDade
Occasional Contributor III
No, when I edit the code like that it fails the entire map and nothing starts.
0 Kudos
AustinDavis
New Contributor III
Reading through some of the API, this may work:
var infoTemplate = new esri.InfoTemplate();
infoTemplate.setContent( '<b>Station:</b><a href="http://${Corner Point Identifier}.pdf">Descriptive Text</a>' );



If this is a valid path:
"http://${Corner Point Identifier}.pdf"
0 Kudos
CraigMcDade
Occasional Contributor III
well that seems to be closer. Now the map draws and the popup comes up, however, it is empty and shows "no information available".

I've tried using similar sample code as located in the "Info Window Lite" sample, however that doesn't work for this either.


I appreciate your help!
0 Kudos
CraigMcDade
Occasional Contributor III
Update:
I can construct the url using:

var template = new esri.InfoTemplate("",
    "<b>Station:</b> http://gisdev2/surveybenchmarks/scans/${Corner Point Identifier}.pdf" ) ;


This populates the popup with the http://.....pdf string

However, the map fails when I try to use the html link constructors.
0 Kudos