# Geocoder, input and event?

**URL:** <https://community.cesium.com/t/geocoder-input-and-event/6192>\
**Category:** CesiumJS\
**Created:** [October 27, 2017, 12:17am UTC](https://community.cesium.com/t/geocoder-input-and-event/6192 "2017-10-27T00:17:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Martine\_Habib](https://avatars.discourse-cdn.com/v4/letter/m/ebca7d/32.png) [@Martine\_Habib](https://community.cesium.com/u/Martine_Habib)\
**Post date:** [October 27, 2017, 12:17am UTC](https://community.cesium.com/t/geocoder-input-and-event/6192/1 "2017-10-27T00:17:51Z")

</div>

**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 ☹

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

Obviously, this doesn’t work… ☹  
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!

---

<div class="post-metadata">

**Author:** ![Gabby\_Getz](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/gabby_getz/32/7838_2.png) [@Gabby\_Getz](https://community.cesium.com/u/Gabby_Getz)\
**Post date:** [October 30, 2017, 9:41pm UTC](https://community.cesium.com/t/geocoder-input-and-event/6192/2 "2017-10-30T21:41:15Z")

</div>

Hey Marhab,

You’ll want to use the [GeocoderViewModel](https://cesiumjs.org/Cesium/Build/Documentation/GeocoderViewModel.html), which contains the UI logic for the Geocoder widget. If all you want to do is adjust the flight time, set [GeocoderViewModel.flightDuration](https://cesiumjs.org/Cesium/Build/Documentation/GeocoderViewModel.html#flightDuration) like in [this example](https://cesiumjs.org/Cesium/Apps/Sandcastle/?src=Hello%20World.html&label=Showcases&gist=930473efe00edb1a168e83617aecf740).

Thanks!

Gabby
