【问题标题】:Prevent Google Maps from disabling input on error防止谷歌地图在错误时禁用输入
【发布时间】:2017-05-01 01:29:50
【问题描述】:

我正在使用 Google Places Javascript API 在网页上的文本框中自动完成街道地址。但是,一些客户报告了文本框被禁用的错误。

我无法在我的网站上复制它,但我发现其他人也报告了同样的事情。例如: Why does my autocomplete search fiels freeze when trying to pull cities from Google Places API?

我的问题是:

  1. 如何重现 Google 地图错误?
  2. 我怎样才能捕捉到这些 错误,并显示错误消息而不是禁用 文本框?

【问题讨论】:

    标签: javascript google-maps-api-3 google-places-api


    【解决方案1】:

    我遇到了同样的问题,Google 有一个功能,您可以在其中获取 Global Places Errors,以便您重新激活那里的字段。

    例子

    function gm_authFailure() {
        //code
    
        document.getElementById('Address').disabled=false;
        document.getElementById('Address').placeholder="";
    
        console.log('General Error with Google Api ');
        return false;
    }
    

    文档: https://developers.google.com/maps/documentation/javascript/events?hl=es-419 https://www.imaginacolombia.com

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-12-01
      • 2016-05-09
      • 1970-01-01
      • 1970-01-01
      • 2011-01-30
      • 1970-01-01
      相关资源
      最近更新 更多