Select to view content in your preferred language

Geocoding widget

1033
4
Jump to solution
06-03-2014 07:47 AM
jaykapalczynski
Honored Contributor
Have been looking at the Geocoders on JavaScript Api site and they all work fine....but looking for a widget that displays possible options as the user is typing in the location.  Is there an example like that out there?

As I start typing  "rich"
a drop down would appear with the options for location that start with "rich"
thus allowing the user to select the one they want

Thanks
0 Kudos
1 Solution

Accepted Solutions
JonathanUihlein
Esri Regular Contributor
https://developers.arcgis.com/javascript/jstutorials/tutorial_geocoder.html

 var geocoder = new Geocoder({   autoComplete: true,   map: map }, dom.byId("search"));


Please make sure you check out our documentation, samples and tutorials.

Also, don't be afraid to use Google.
The above link is the first entry when searching for "esri geocoder autocomplete"

View solution in original post

0 Kudos
4 Replies
JonathanUihlein
Esri Regular Contributor
https://developers.arcgis.com/javascript/jstutorials/tutorial_geocoder.html

 var geocoder = new Geocoder({   autoComplete: true,   map: map }, dom.byId("search"));


Please make sure you check out our documentation, samples and tutorials.

Also, don't be afraid to use Google.
The above link is the first entry when searching for "esri geocoder autocomplete"
0 Kudos
jaykapalczynski
Honored Contributor
Thanks....was looking at this example and it does not mention the autocomplete

https://developers.arcgis.com/javascript/jssamples/locator_simple.html

And different code....confusing sometimes


    
var geocoder = new Geocoder({
        map: map
    }, "search");
 geocoder.startup();


 
var geocoder = new Geocoder({
  autoComplete: true,
  map: map,
}, dom.byId("search"));
geocoder.startup();
0 Kudos
JonathanUihlein
Esri Regular Contributor
Thanks....was looking at this example and it does not mention the autocomplete

https://developers.arcgis.com/javascript/jssamples/locator_simple.html

And different code....confusing sometimes



No worries. Remember, the documentation always has more information than a sample can convey.

In regards to:
    
var geocoder = new Geocoder({
        map: map
    }, "search");
 geocoder.startup();


 
var geocoder = new Geocoder({
  autoComplete: true,
  map: map,
}, dom.byId("search"));
geocoder.startup();


Both of these do the same thing in practice.. it comes down to preference and understanding why one way works versus the other. Without getting into too much detail, the Geocoder widget handles both of these methods for setting the srcNodeRef.

Coding styles differ like local accents in language... a southern accent compared to a New York accent for example. You can say the same thing in many different ways 🙂
As long as you understand "why" and "how", you will be able to understand the difference in any code.
0 Kudos
jaykapalczynski
Honored Contributor
Appreciated....Thanks
0 Kudos