Identify with Layer Toggling

Discussion created by mdlong on Jul 28, 2011
Latest reply on Jul 29, 2011 by DSwingley-esristaff
I have spent some time reading the numerous threads about setting the identify task to work with layer toggling and I seem to have it working properly except for one small issue.  The identify task will continue to work even though all of the layers are turned off.  The Pop-Up dialogue will show "searching" for some time, until the JavaScript times out.  The more problematic issue is that the task will lock up a SOC process until it times out as well, which is much longer than the JavaScript time out.  This gives the user the ability to use the identify task again, repeating the process above, and locking up another SOC process.  Since 2 SOC processes are the default this means that the service is useless until one of them times out.

Click below to view an example of this behavior.  This is hitting the sample server so you will have to take my word on the "hung" SOC processes.

My question is two fold.
1: Could this be a bug?
2: Any ideas on how to keep the identify task from executing when there are no layers visible?

Thanks for your help.

I have also posted this question on StackExchange here.