AnsweredAssumed Answered

Trigger find() or search method of Geocoder widget friom programmatic enter or return event on Sear_input

Question asked by on Apr 27, 2017

I am utilizing a Geocoder widget for my company project and it is being used in our website as an iframe. I want to trigger find() to invoke search_input

The Geocoder search input in teh below html gets populated when I enter an address in the parent html and the Requirement is when I click submit from parent window, or focus outfrom the field in parent window I want to fire search in the autopopulated Geocoder search input.

The Geocoder input doesn't search even if I programmatically click no the search icon using 
1. $("div.esriGeocoderSearch.esriGeocoderIcon").click(); doesnt work
2. Nor a programamitc Keydown event on search input ofteh Geocoder  works

Is there a away to call the geocoders find() from another method to trigger the search like using something as  geocoder.find();

Here is the mapless.js which is being utilized in the html

"dojo/parser", "dijit/registry",
], function (Map, dom, on, Query, QueryTask, Geocoder, RadioButton, parser, registry ) {

var queryTask = new QueryTask("");
geocoder = new Geocoder({
//map: map,
autoComplete: true,
arcgisGeocoder: {
placeholder: "Please Enter an Address",
sourceCountry: "USA",
}, dojo.byId("search"));
//geocoder.on("select", showResults);
geocoder.on('find-results', showResults);

function showResults (evt) {
if(evt.results.results.length > 0){
//var point = evt.result.feature.geometry, DAC;
var point = evt.results.results[0].feature.geometry;
var lat = point.getLatitude(), lon=lon=point.getLongitude();
var query = new Query();
query.returnGeometry = false;
query.outFields = ["CENSUS_TRA","COUNTY","CITY","CES_3_0_Sc"];
query.geometry = point;
queryTask.execute(query, function (featureSet) {
if (featureSet.features.length==0){
DAC= 'Location is not within a Disadvantaged Community';
} else { DAC='Location is within a Disadvantaged Community'};
resultItems = [];
var resultCount = featureSet.features.length;
for (var i = 0; i < resultCount; i++) {
var featureAttributes = featureSet.features[i].attributes;
for (var attr in featureAttributes) {
resultItems.push("<b>" + attr + ":</b> " + featureAttributes[attr] + "<br>");
dojo.byId("geocodeResults").innerHTML = DAC;//resultItems.join("");
} else {
dojo.byId("geocodeResults").innerHTML = "Address not found";


And the HTML is as follows:

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">
<title>Mapless DAC locator</title>
<link rel="stylesheet" href="">
<link rel="stylesheet" href="">
html, body {
font:normal 12px verdana;
.results {
text-indent: 10px;

.dijitCheckBoxInput {
opacity: 100;
.dijitCheckBox, .dijitRadio, .dijitCheckBoxInput {
width: 14px;
<script src=""></script>
<script src=""></script>
<script src="http://localhost:3000/js/trigger.js"></script>

<script src="http://localhost:3000/js/mapless.js"> </script>

<b>Please enter the property address:</b><br>
<div id="search" style=""></div>
<span id="info"></span>

<div id="geocodeResults" class="results" style="text-indent:10px;"></div>
<div id="bldgResults" class="results"></div>