Geocoder widget not accepting <cr>

596
3
03-16-2013 12:23 AM
BillHoney
New Contributor III
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 
} 
0 Kudos
3 Replies
BillHoney
New Contributor III
Can anyone confirm that this is a problem is IE8?  Seems to work OK in chrome & ff.
Is there a fix ?
thanks, Bill
0 Kudos
ChrisCantey
New Contributor
I am having the same issue with 3.9. A carriage return refreshes the page. If I click on the finder icon it works, across all browsers. Very frustrating.

Chris
0 Kudos
JonathanUihlein
Esri Regular Contributor
Hi Chris,

Could you provide a sample <cr> you are using as a test case?

This thread is very old and I am unsure Bill ever solved his issue.
In the future, feel free to create a new thread with your issue.
0 Kudos