• Resolved bcanr2d2

    (@bcanr2d2)


    I was wondering if there was a way to force the plugin to only have users select a street address, and not allow them to just type in a suburb.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author shanebp

    (@shanebp)

    If your users are simply typing in the address and then doing a save, that will not work.
    They need to start typing and then select one of the complete and verified addresses that Google provides in the dropdown.
    Otherwise, a call is not made to Google and therefore the lat / lng coords are not returned.

    A few other people have had this issue – we tried several approaches to force users to make a selection from the dropdown. Unfortunately, while we could force them to make a selection, there were other side effects that created a potentially very confusing UX.

    So the only usable solution was adding a note in the field description that alerted the user to the fact that they have to made a selection if they want to appear on the map.

    Thread Starter bcanr2d2

    (@bcanr2d2)

    I am making sure to tell users to select an item from the drop down. Perhaps I didn’t make myself clear enough. What I am after is limiting my results to show addresses, is there any way to hook into your code to make a different request to the Google Maps/Places API to force it to return results that are addresses.

    IE I don’t want people to be able to select Somewhereville, SomeState, SomeCountry. But to select 123 Some Street, Somewhereville, SomeState, SomeCountry.

    I had a quick read through and someone else has managed to make this change, I am not sure how to acheive it.

    Plugin Author shanebp

    (@shanebp)

    >I had a quick read through and someone else has managed to make this change

    Link?

    Thread Starter bcanr2d2

    (@bcanr2d2)

    I think I may have got it all mixed up. I know you can specify the type street-addresses for what is returned by the Google Maps API.
    https://developers.google.com/maps/documentation/javascript/places-autocomplete

    allows you to set the options to address. If I knew your Google Maps Places API code, I could change myself. But I want to know if I can hook into it instead.

    Plugin Author shanebp

    (@shanebp)

    There is no hook.
    If you know the Google Places API options, you could try adjusting the initialization call in the javascript in this file: class-pp-field-type-location.php

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Force Autocomplete to only allow addresses’ is closed to new replies.