I have a button that is being pressed to select features based on a query the user inputs. The function works, but the on "selection-complete" part is firing multiple times. When the button is clicked the first time, it fires once. When it is clicked the second time, it fires twice, etc. Is there any way to prevent this behavior? I want to include more in the on complete function but cannot because it is looping multiple times.
// when selection is complete, zoom to the selected features
where site selection is defined by:
siteSelection = new Query();
siteSelection.returnGeometry = true;
siteSelection.outFields = ["*"];
siteSelection.where = queryField + " LIKE '%" + queryText + "%'";