-1

I am currently trying to create a form using Formik that includes a location and I would like to use Google Places Autocomplete.

I have been able to successful get the Google Places data that I want, but it's triggering a form submit.

I create a sandbox of the issue: https://codesandbox.io/embed/0xrrmj024p

This is my first time using Formik and I know that I need to probably use setValueField once I get the data from Google Places.

My first concern is to just not have the Google Autocomplete trigger form submit, then I will worry about passing the value to Formik.

1 Answers1

0

Figured it out!

var input = document.getElementById("googleLocation");
    google.maps.event.addDomListener(input, "keydown", function(event) {
      if (event.keyCode === 13) {
        event.preventDefault();
      }
    });