jbenson

Hyperlink inside IdentifyTask using esri.InfoTemplate

Discussion created by jbenson on Jun 7, 2011
Latest reply on Jun 8, 2011 by jmgorman
I have modified the sample Identify features on a map (http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples/find_popup.html) to work with my data.  One of my fields is an address to the website (URL).  How do I make this active such that a user can click on it and get to the new page?  Here is the code that brings up the identify results.  It lists the URL, but it is not active.  My two fields are Content and URL.

   function executeIdentifyTask(evt) {
        identifyParams.geometry = evt.mapPoint;
        identifyParams.mapExtent = map.extent;
       
        var deferred = identifyTask.execute(identifyParams);

        deferred.addCallback(function(response) {     
          // response is an array of identify result objects    
          // Let's return an array of features.
          return dojo.map(response, function(result) {
            var feature = result.feature;
            feature.attributes.layerName = result.layerName;
            if(result.layerName === 'EcoFOCIGOALarval'){
//              console.log(feature.attributes.Content);
              var template = new esri.InfoTemplate("", "${Content} <br/>Link: : ${URL}"); 
              feature.setInfoTemplate(template);
            }
             else if (result.layerName === 'AITrawl'){
              var template = new esri.InfoTemplate("", "${Content} <br/> Link: : ${URL}");  
              feature.setInfoTemplate(template);
             }
            else if (result.layerName === 'CTDSections'){
              var template = new esri.InfoTemplate("", "${Content} <br/> Link: : ${URL}");  
              feature.setInfoTemplate(template);
            }    
            else if (result.layerName === 'EBSSurveyGridDis'){
              var template = new esri.InfoTemplate("", "${Content} <br/> Link: : ${URL}");  
              feature.setInfoTemplate(template);                
            }           
            else if (result.layerName === 'SSL2010BiOpZones1'){
              var template = new esri.InfoTemplate("", "${Content} <br/> Link: : ${URL}");  
              feature.setInfoTemplate(template);
            }
            return feature;
          });
        });

If there is an easier way, I'm open.  This is a very simple application.

Thanks,
Jan

Attachments

Outcomes