Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Enforcing a full address user input

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 could 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,

like image 594
Or Weinberger Avatar asked Dec 28 '25 22:12

Or Weinberger


1 Answers

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.

like image 185
Kristoffer la Cour Avatar answered Dec 30 '25 14:12

Kristoffer la Cour



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!