AnsweredAssumed Answered

address-to-locations-complete runs callback function repeatedly

Question asked by aparveen on Sep 9, 2015
Latest reply on Sep 9, 2015 by aparveen

Hi, I am using address-to-locations-complete event with our custom locator, now if I type wrong address or garbage address, and click find button, the locator task runs just fine and brought 0 result and then show an alert msg saying "Address not Found", first time it works fine but I input wrong address or garbage address again, the alert box comes up twice, and this goes on and on..which is very annoying, did any of you see this behavior? I will appreciate any help in this regard, thanks--AZIZA


I made a very simple bare bone app with only few lines of code in it, I am pretty sure you guys can replicate this issue.


var searchByAddress, showResultLocation;






], function (locator) {
 = false; = false;"");"");


    var rvcLocator = new locator(locator);

    searchByAddress = function () {


        var address = {

            SingleLine: document.getElementById("search").value



        var options = {

            address: address,

            outFields: ["*"]



        showResultLocation = function (evt) {

            var resultLocations = evt.addresses.length;

            if (resultLocations == 0) {

                alert("No Address found");




        rvcLocator.on("address-to-locations-complete", showResultLocation);









<!DOCTYPE html>





   <title>ArcGIS API for JavaScript | Basic Search</title>

   <link rel="stylesheet" href="">

   <link rel="stylesheet" href="">





      #search {

         display: block;

         position: absolute;

         z-index: 2;

         top: 20px;

         left: 74px;



   <script src=""></script>

   <script src="JS/test.js"></script>





   <input id ="search" type="text"/>

   <input id="searchAddBtn" type="button" value="FIND" onclick="searchByAddress();"/>