pigochu / yii2-jquery-locationpicker

jquery location picker widget for yii2
20 stars 7 forks source link

Custom Expression #19

Closed deshario closed 6 years ago

deshario commented 6 years ago

How can I get the more values by custom expression ... Currently i can access only latitude and longtitude .... I had print the object in console that gets from onchanged ... it has only latitude and longtitude ... I'm trying to access more data such as full address .. How can i do that ? #Thankx

new1 new2

pigochu commented 6 years ago

You can not get searchBox value from server ?

I think you could create a hidden input , than implement js onsubmit event and copy searchbox value to your hidden input.

If you want to get more info from server. you can use Geocoding API . https://developers.google.com/maps/documentation/geocoding/intro.

pigochu commented 6 years ago

you can also read how to Binding UI with the widget , than implement inputBinding map to your hidden input. http://logicify.github.io/jquery-locationpicker-plugin/

pigochu commented 6 years ago

@deshario in onchanged event , you can use addressComponents. var addressComponents = $(this).locationpicker('map').location.addressComponents;

deshario commented 6 years ago

There are only 4-5 attributes that can be accessible from addressComponents ... It will be great if we can access full address. Thankx

pigochu commented 6 years ago

@deshario

I dont understand fulladdress what you want , but I can get full address from formattedAddress.

image