Hi, I am having trouble with the geocoder widget not accepting <carriage return> in the search box. It seems to sometimes work in firefox, but not at all in IE. I have tried adding my own keystroke handler & then executing a geocoder.find() followed by a geocode.select(results) but this fails to fire the geocoder_onSelect() event. Can anyone advise is this is a bug or am I implementing something wrongly, Bill // create the geocoder
geocoder = new esri.dijit.Geocoder({
autoComplete: true,
showResults: true,
autoNavigate: true,
placeholder: "find thngs",
//arcgisGeocoder: false,
arcgisGeocoder: {
placeholder: "search...",
sourceCountry: "GB"
},
maxLocations: 10,
map: map,
theme: "simpleGeocoder", //"arcgisGeocoder"
geocoders: geocoders // use our own alongside esri default one
}, "divGeocodeSearch");
dojo.connect(geocoder, "onSelect", geocoder_onSelect);
dojo.connect(geocoder, "onFindResults", geocoder_onFindResults); // for manually capturing the results of a find
var inputbox = dojo.byId("divGeocodeSearch");
dojo.connect(inputbox, "onkeydown", geocoder_onKeyDown); // seems buggy about accepting <cr> so capture it myself
geocoder.startup();
}
function geocoder_onKeyDown(event) {
if (event.keyCode == dojo.keys.ENTER)
geocoder.find();
}
function geocoder_onFindResults(results) {
if (results.length > 0) geocoder.select(results[0]);
}
///////////////////////////
// FAILS TO FIRE ON <CR> (without the extra keystroke handler above)
// FAILS TO FIRE ON geocoder.select(results[0]);
function geocoder_onSelect(result) {
// DO STUFF WITH THE RESULT
}