HiThat's not the link to my site. Unfortunately whilst the site is being developed the systems administrator has password protected the mapping services. So I can't supply a link to the current application. However here is the code for the function that is handling the click event.
function checkAuthority(event){
qBuffer.geometry = event.mapPoint;
//execute query
qTaskBuffer.execute(qBuffer,function(featureSet){
//show pop-up if location does not intersect road buffer layer
if(featureSet.features.length===0){
map.infoWindow.setTitle("Warning");
map.infoWindow.resize(300,250);
map.infoWindow.setContent("The location you have selected is not on a road, please try marking the defect again.");
map.infoWindow.show(event.mapPoint);
document.getElementById("loadingLayer").style.display = "none";
if(mapscale>2000){map.setLevel(12);} //level 12 is 1:2,000
closeResults();
}else if(featureSet.features.length===1){//function to display one result only
displayResult(featureSet.features[0],event);
}else{//call function to display multiple results
displayResults(featureSet,event);
}
});
}
Basically it checks that the mouse click intersects a polygon layer. If it does then the results are verified then displayed to the user. If the location of the mouse click does not intersect the polygon layer a message is displayed to the user. Currently this works fine if the user has zoomed or panned around the map, however if they click on the map once the data has loaded and have not panned or zoomed it returns an error. I have trapped the error using the "onError" event of the qTaskBuffer, but the message property of the error object is empty and it does not recognise the instance type. Using the onError event has allowed me to prompt the user to click on the map again, they click on the map and the process is successful.I've tested the application in numerous browsers and different versions of the API and still get the same result. Any advice would be very welcome.Kind regardsDavid