React-google-maps: event object in search box

Created on 12 Nov 2016  路  2Comments  路  Source: tomchentw/react-google-maps

Hi,

Looking at the examples page, is there a way to access the event from within the handlePlacesChanged() method?

It accidentally triggers a form submit in my code and I'd like to e.preventDefault() it.

Thanks

Most helpful comment

For anyone else stumbling across this, add this to the <input>

onKeyDown={(e) => { 
                            if (e.keyCode == '13') 
                                e.preventDefault()
                        }}

https://stackoverflow.com/questions/11388251/google-autocomplete-enter-to-select/28373354

All 2 comments

Please refer to Getting Help section in the README (or #469).

For anyone else stumbling across this, add this to the <input>

onKeyDown={(e) => { 
                            if (e.keyCode == '13') 
                                e.preventDefault()
                        }}

https://stackoverflow.com/questions/11388251/google-autocomplete-enter-to-select/28373354

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bossbossk20 picture bossbossk20  路  3Comments

LukasZvikas picture LukasZvikas  路  3Comments

julienvincent picture julienvincent  路  3Comments

craigcartmell picture craigcartmell  路  4Comments

farhan687 picture farhan687  路  3Comments