开发者

Enforcing a full address user input

开发者 https://www.devze.com 2023-02-19 16:33 出处:网络
In my website, I allow members to use the Google Maps integration I have in order to search and select their home address.

In my website, I allow members to use the Google Maps integration I have in order to search and select their home address.

I'm trying to figure out a way in which I co开发者_如何学JAVAuld enforce a full address selection only.

At the moment, the member sees a search box and a map, once he inputs a search the result is shown on the map and he can choose 'This is my address'.

My current issue is that a lot of people selects 'Fairfax, USA' for example, rather than the exact address.

I know this is a lot about disciplining the members, but is there any technical way of preventing them from choosing a 'too general' address?

Thanks,


I haven't worked much with the google maps api, but you can send their input to the web service api, and load the first given result, and ask if that's their address, and only accept addresses from the api...

Edit: (Based on our talk in the comments) When you ask the api to find an address it tells you what kind of location it returns for you, just simply check for "type" "street_address" on line four of your result like in this api request.

0

精彩评论

暂无评论...
验证码 换一张
取 消