Disable button based on zoom

Discussion created by deleted-user-yA_w_FC9FKe5 on Apr 18, 2014
Latest reply on Apr 21, 2014 by BSnider-esristaff
I have a button that is summarizing data but I want the toggle button to only be enabled when at a certain zoom and then disabled when above it.  How can I do this?

        new ToggleButton({
          showLabel: true,
          onChange: function(val){           
            if(val == true){
     document.getElementById("messages").style.display = 'block'
     buffer = map.on("click", function(evt){
                circle = new Circle({
                center: evt.mapPoint,
                geodesic: true,
                radius: 1,
                radiusUnit: "esriMiles"
              //Being used;
              var graphic = new Graphic(circle, circleSymb);

              var query = new Query();
              query.geometry = circle.getExtent();
              //use a fast bounding box query. will only go to the server if bounding box is outside of the visible map
              featureLayer.queryFeatures(query, selectInBuffer);
            this.set('label', 'Close Buffer Report Tool');
            document.getElementById("messages").style.display = 'none'
   this.set('label', 'Open Buffer Report Tool');
   dom.byId("messages").innerHTML = "Click on the map <br> to select 5 mile buffer.";
          label: "Open Buffer Report Tool"
        }, "btnBufferTool");