//Measurement Tool       var measurement = new esri.dijit.Measurement({              map: map,     defaultLengthUnit: esri.Units.FEET,      }, dojo.byId('measurementDiv'));             measurement.startup();                       dojo.connect(measurement, "onMeasureEnd", function(activeTool,geometry){          this.setTool(activeTool, false),    });  //Identify Event function executeIdentifyTask(evt) {             identifyParams.geometry = evt.mapPoint;         identifyParams.mapExtent = map.extent;         var deferred = identifyTask.execute(identifyParams);          deferred.addCallback(function(response) {              return dojo.map(response, function(result) {         var feature = new esri.Graphic(result.feature.toJson());;                        feature.attributes.layerName = result.layerName;         if(result.layerName === 'Section Corners' || result.layerName === 'Accessory Monuments'){          // console.log(feature.attributes.POINT_NAME);          var template = new esri.InfoTemplate("Monuments", "Point Name: ${POINT_NAME}<br/><a target='_blank'  href='http://surveyor.slco.org/jsapi/map/mrs_javamap.cfm?LAT=${LATITUDE}&LONG=${LONGITUDE}&POINT_NAME=${POINT_NAME}'>Mon. Ref. Sheet</a>");          feature.setInfoTemplate(template);             }             else if (result.layerName === 'Surveys'){             var template = new esri.InfoTemplate("Surveys", "${SURVEYOR}<br/> Survey Number: ${DOCUMENT_N}<br/><a target='_blank' href='http://surveyor.slco.org/jsapi/map/sire_survey_image.cfc?page_id=${page_id}'>Survey PDF Document</a>");               feature.setInfoTemplate(template);             }                 return feature;           });         });                    map.infoWindow.setFeatures([ deferred ]);         map.infoWindow.show(evt.mapPoint);       }    
					
				
			
			
				
			
			
				Solved! Go to Solution.
function executeIdentifyTask(evt) {        var measureMode =   dojo.query(".esriButton .dijitButtonNode").some(function(node, index, arr){             if(node.childNodes[0].checked){             //at least one of the measure tools is active so disable identify             return true;                        }        });        if(! measureMode){         map.graphics.clear();         identifyParams.geometry = evt.mapPoint;         identifyParams.mapExtent = map.extent;          var deferred = identifyTask.execute(identifyParams);         deferred.addCallback(function(response) {              return dojo.map(response, function(result) {         var feature = new esri.Graphic(result.feature.toJson());;               feature.attributes.layerName = result.layerName;             if(result.layerName === 'Section Corners' || result.layerName === 'Accessory Monuments'){                         var template = new esri.InfoTemplate("Monuments", "Point Name: ${POINT_NAME}<br/><a target='_blank' href='../../mrs_javamap.cfm?LAT=${LATITUDE}&LONG=${LONGITUDE}&POINT_NAME=${POINT_NAME}'>Mon. Ref. Sheet</a>");               feature.setInfoTemplate(template);             }             else if (result.layerName === 'Surveys'){           var template = new esri.InfoTemplate("Surveys", "${SURVEYOR}<br/> Survey Number: ${DOCUMENT_N}<br/>Address: ${ADDRESS_OF_SURVEY}<br/><a target='_blank' href='../../sire_survey_image.cfc?page_id=${page_id}'>Survey PDF Document</a>");               feature.setInfoTemplate(template);             }                 return feature;           });         });                    map.infoWindow.setFeatures([ deferred ]);         map.infoWindow.show(evt.mapPoint);       }     }  var identifyHandler = map.on("click", executeIdentifyTask);$(".measure_trigger").click(function(e){
                e.preventDefault();
                dojo.disconnect(identifyHandler);
                return false;
            });I know this is a javascript question and not arcgis--but, wondering how you reconnect a saved handler? Not able to figure that out with the docs...
I save my handler like this:
window.myHandler = dojo.connect(window.myMap, "onClick", runIdentifies)
Later, I do:
dojo.disconnect(window.myHandler);
Is there any way to do the following:
dojo.connect(window.myHandler)
This is because i'm having issues accessing the runIdentifies function from where I want to reconnect.
Okay, that's perfect. Thank you.
// invoke toggleIdentify after measurement.setTool is called.
// The last parameter "true" means to pass the setTool parameter to toggleIdentify 
dojo.aspect.after(measurement, "setTool", toggleIdentify, true);
function toggleIdentify(toolName, activate) {
    // disable identifyHandler when measurement tool is set and activated
    if (activate && identifyHandler) {
        dojo.disconnect(identifyHandler);
        identifyHandler = null;
    }
    // activate identify tool otherwise
    else {
        identifyHandler = map.on("click", executeIdentifyTask);
    }
}
					
				
			
			
				
			
			
				
			
			
			
			
			
			
		var identifyHandler = (map,"onClick",executeIdentifyTask);
var measurement = new esri.dijit.Measurement({ 
           map: map,
    defaultLengthUnit: esri.Units.FEET, 
 }, dojo.byId('measurementDiv')); 
           measurement.startup(); 
  
   dojo.connect(measurement, "onMeasureEnd", function(activeTool,geometry){
   dojo.disconnect(identifyHandler);
   return false;
   this.setTool(activeTool, false)
   });
					
				
			
			
				
			
			
				
			
			
			
			
			
			
		
var identifyHandler = (map,"onClick",executeIdentifyTask);
  
 
  var measurement = new esri.dijit.Measurement({ 
                map: map,
  defaultLengthUnit: esri.Units.FEET, 
  }, dojo.byId('measurementDiv')); 
                measurement.startup(); 
     
     
   dojo.connect(measurement, "onMeasureEnd", function(activeTool,geometry){
   this.setTool(activeTool, false)
   dojo.aspect.after(measurement, "setTool", toggleIdentify, true);
   });
   
       function toggleIdentify(measurement, activate) {
    // disable identifyHandler when measurement tool is set and activated
    if (activate && identifyHandler) {
        dojo.disconnect(identifyHandler);
        identifyHandler = null;
    }
    // activate identify tool otherwise
    else {
        identifyHandler = (map, "onClick", executeIdentifyTask);
    }
}
    measurement.deactivate = function() {
    var locationBtn = dijit.byId('location'),
         distanceBtn = dijit.byId('distance'),
         areaBtn = dijit.byId('area')
  this.closeTool();
  locationBtn.setAttribute('checked', false);
  distanceBtn.setAttribute('checked', false);
  areaBtn.setAttribute('checked', false);
 
}  
function mapReady(map){
  
    var identifyHandler = (map,"onClick",executeIdentifyTask);
       dojo.connect(map,"onClick",executeIdentifyTask);
       //create identify tasks and setup parameters 
       identifyTask = new esri.tasks.IdentifyTask("http://gis10.slco.org/SLCOGIS/rest/services/public/Surveyor_New/MapServer");
       
       identifyParams = new esri.tasks.IdentifyParameters();
       identifyParams.tolerance = 8;
       identifyParams.returnGeometry = true;
       identifyParams.layerIds = [1,2,4];
       identifyParams.layerOption = esri.tasks.IdentifyParameters.LAYER_OPTION_ALL;
       identifyParams.width  = map.width;
       identifyParams.height = map.height;
      }
      
   
      function executeIdentifyTask(evt) {
   
        identifyParams.geometry = evt.mapPoint;
        identifyParams.mapExtent = map.extent;
        var deferred = identifyTask.execute(identifyParams);
        deferred.addCallback(function(response) {     
        return dojo.map(response, function(result) {
        var feature = new esri.Graphic(result.feature.toJson());;
    
         
            feature.attributes.layerName = result.layerName;
            if(result.layerName === 'Section Corners' || result.layerName === 'Accessory Monuments'){
             // console.log(feature.attributes.POINT_NAME);
               var template = new esri.InfoTemplate("Monuments", "Point Name: ${POINT_NAME}<br/><a target='_blank' href='http://surveyor.slco.org/jsapi/map/mrs_javamap.cfm?LAT=${LATITUDE}&LONG=${LONGITUDE}&POINT_NAME=${POINT_NAME}'>Mon. Ref. Sheet</a>");
              feature.setInfoTemplate(template);
            }
            else if (result.layerName === 'Surveys'){
              var template = new esri.InfoTemplate("Surveys", "${SURVEYOR}<br/> Survey Number: ${DOCUMENT_N}<br/>Address: ${ADDRESS_OF_SURVEY}<br/><a target='_blank' href='http://surveyor.slco.org/jsapi/map/sire_survey_image.cfc?page_id=${page_id}'>Survey PDF Document</a>");
              feature.setInfoTemplate(template);
            }
   
            return feature;
          });
        });
   
      
        map.infoWindow.setFeatures([ deferred ]);
        map.infoWindow.show(evt.mapPoint);
      }    
					
				
			
			
				
			
			
				
			
			
			
			
			
			
		