Geocoder, input and event?

1. A concise explanation of the problem you’re experiencing.

I am using the default geocoder.

I would like to catch the event that fires when the user enters an address, and presses the search button.

Ideally, I would also like to reduce the amount of zooming in that the geocoder does.

I get this error by calling the code below:

Uncaught TypeError: Cannot read property ‘addEventListener’ of null

2. A minimal code example. If you’ve found a bug, this helps us reproduce and repair it.

This is the code I am calling (winging it!)

var searchButton = document.getElementById(‘cesium-geocoder-searchButton’); // searchButton is undefined :frowning:

searchButton.addEventListener(‘click’, showSearchInput, false);

Obviously, this doesn’t work… :frowning:
How do I catch the click event on the search button?

I already have a click handler in my code…is there a way to determine that I am clicking on the search button?

3. Context. Why do you need to do this? We might know a better way to accomplish your goal.

I want to show a point, and the address that the user entered in the search box, when the user presses on the search button.

I also would like control of the amount of zooming in when the geocoder does the flight.

4. The Cesium version you’re using, your operating system and browser.

1.38, mac, chrome

Thank you!

Hey Marhab,

You’ll want to use the GeocoderViewModel, which contains the UI logic for the Geocoder widget. If all you want to do is adjust the flight time, set GeocoderViewModel.flightDuration like in this example.