I'm using the OSM field and am trying autocomplete address vs separate address, city, country fields.
With Autocomplete you can tell if the system recognises the address because, well, it autocompletes. With the separate fields, you need to click on "find address" to trigger the location update, and if no address is found no feedback is given whatsoever.
As a separate, but related issue, the fact you can drag the pin around is confusing to the user, because it looks like you can set the coordinates that way, especially if the address is not found automatically.
I could live with it as long as this is only in the back-end, but now I'm adding this to a user-facing form (in the user profile) so the confusing behaviour is not really acceptable to the client.
What are my alternatives?
Here are a few options:
- the pin to either be locked (so the user can't drag it around), or to actually update the coordinates to the position the user places it.
- the find address function to be triggered every time the user changes the address, city, and country
- give the user feedback when the address is updated, and especially if no address is found using the entered data
- trigger the find address function on submit if the user doesn't click on the button
I agree. I'm actually hiding the "Find Address" button because it just confuses my clients.
I've just updated the plugin to add an alert when users clicking the Find Address but no address found.
According to the options:
– the pin to either be locked (so the user can’t drag it around), or to actually update the coordinates to the position the user places it.
That would be confusing when users want to manually select or adjust an address on the map.
– the find address function to be triggered every time the user changes the address, city, and country
That's possible. But that might cause a non-friendly experience if users are entering the data and see the "No results found" message.
I think that can be done when user done typing on the address fields.
Implementing this behavior, we don't need the "Find Address" button anymore.
– give the user feedback when the address is updated, and especially if no address is found using the entered data
Done the part of notifying users when no address is found.
Showing a notification when an address is found seems weird, especially if we do the automatically adjust the map as above.
– trigger the find address function on submit if the user doesn’t click on the button
I don't think this is a good option, since it confuses users (as they didn't select an address).
In my opinion, implementing the "auto adjust the map when address change" is the best option. I'll try to do that now and let you guys see the result.
Update: I've done that here. Please download and let me know what you think.
I'm currently using the MetaBox AIO plug-in on this project.
I followed the link but it looks like it's the main MetaBox plug-in, not the Geolocation extension?
Should I replace the main MetaBox plug-in with the one from the commit?
Yes, that's right. Please replace the existing Meta Box with the Github version.
OK will try today!
BTW, I'm working on a front-end implementation using Leaflet and I found it useful to include this JS library to avoid scrolling the map while scrolling the page: https://github.com/elmarquis/Leaflet.GestureHandling
I'm still confused on one thing... why can I drag the pin around in the map?
Won't the coordinates be taken from the autocomplete address field anyway?
Sometimes, the Geocoder doesn't return precise coordinates (in some countries where OSM / Google Maps don't have enough data). In that case we should allow users to drag the pin to correct address.
I'll include the library into OSM field. Thanks for suggesting!
Oh I see... so the coordinates are updated based on the pin location!
That was unclear, especially with the "find address" button in the mix.
Perhaps read-only fields with latitude and longitude would make it more clear to the user that he can drag the pin to fine-tune the location.
Thanks Anh! I'm loving developing with MetaBox.