Jeff VIP
Total posts: 745
19 Фев 2015 05:56

Hi,

I am trying to minimise the number of steps for a user to enter a location.

Right now, I use the autocomplete box to enter and choose a location. However, the user needs to hit the apply button (aka 'marker from address') to actually save the selected place.

birth location

I would like a location to be automatically set after selecting a location from the autocomplete box. How can I accomplish this?

Best regards, Jeff

Последние изменения: 24 Фев 2015


Jeff VIP
Total posts: 745
19 Фев 2015 06:14

Btw. The other grey button is to enter a location manually in case the name of a location is not properly saved. This might happen when someone enters an Island (eg Terschelling ) or a place that the Geo field can't save.

custom label

Somehow the Geo field still doesn't save all details of a location. In the example of 'Terschelling', the autocomplete box will suggest that location, but instead of 'Terschelling' only the state 'Friesland' is saved. For a complete check of what data exactly is available per location have a look at http://ubilabs.github.io/geocomplete/examples/form.html Interestingly the formatted address is always saved correctly, but until now I haven't been able to use this field in Cobalt.

formatted address


jimie VIP
Total posts: 531
19 Фев 2015 09:17

Hey Jeff, do you think you can share this custom input template you created please ?

Regards


Sergey
Total posts: 13,748
20 Фев 2015 03:14

Jeff I would like a location to be automatically set after selecting a location from the autocomplete box. How can I accomplish this?

I am not sure what is your code, but this is how it works in goe field by default. On enter it selected location. Although there were little bug. Form was reloaded after press enter in the input, but I fixed that.

Jeff , but instead of 'Terschelling' only the state 'Friesland' is saved

Added some changes. You mean when you click address from marker, right?


Jeff VIP
Total posts: 745
20 Фев 2015 04:09

Sergey I am not sure what is your code, but this is how it works in goe field by default. On enter it selected location. Although there were little bug. Form was reloaded after press enter in the input, but I fixed that.

Can I download the fixed version so I can test it?

Sergey Added some changes. You mean when you click address from marker, right?

Yes


Sergey
Total posts: 13,748
20 Фев 2015 04:56

I'll update Cobalt later today with number of changes.


Jeff VIP
Total posts: 745
20 Фев 2015 05:00

Sergey I'll update Cobalt later today with number of changes.

Thank you, Sergey!


Jeff VIP
Total posts: 745
20 Фев 2015 23:59

Hi Sergey,

  1. I have updated Cobalt and the Geo field to the latest version. Unfortunately I still have to hit the Marker to address button to get all the address fields filled, so no change here.....

  2. Entering 'Terschelling' adds the name to the state field. Good! But it is placed after the state 'Friesland' which is incorrect. It should be placed first. So 'Friesland, Terschelling' should be 'Terschelling, Friesland'.

Please try to enter 'Mvezo, South Africa', 'Mvezo' isn't recognised. Could you please verify that?

jimie Hey Jeff, do you think you can share this custom input template you created please ?

To show and hide the custom place field I'm using functionality that's included in Yootheme Warp's framework. Unless your template uses Warp, I'm not sure is usable to you. Once I can get rid of the Apply button, I'm more than happy to share it with you.


jimie VIP
Total posts: 531
21 Фев 2015 06:08

Hello Jeff,

Actually I'm using warp framewak too, I was always using it as I found at the time when I started with the only template framework which was not creating problems :)

Rgds


Sergey
Total posts: 13,748
23 Фев 2015 03:49

Jeff I have updated Cobalt and the Geo field to the latest version. Unfortunately I still have to hit the Marker to address button to get all the address fields filled, so no change here.....

This I did not change. yes you still have to click button. If you want to avoid it find function onPlaceChange and add there setAddress(place.address_components); right after if (place.geometry) { in geo/assets/geo.js.

Jeff Entering 'Terschelling' adds the name to the state field. Good! But it is placed after the state 'Friesland' which is incorrect. It should be placed first. So 'Friesland, Terschelling' should be 'Terschelling, Friesland'.

Fixed.


Jeff VIP
Total posts: 745
24 Фев 2015 04:43

Sergey This I did not change. yes you still have to click button. If you want to avoid it find function onPlaceChange and add there setAddress(place.address_components); right after if (place.geometry) { in geo/assets/geo.js.

+1

Sergey, could you please include sublocalities into the state field?

Mvezo (South Africa) is a sublocality which can be found on Google Maps, but which isn't saved by the Geo field.


Sergey
Total posts: 13,748
24 Фев 2015 05:31

Jeff Sergey, could you please include sublocalities into the state field?

Mvezo (South Africa) is a sublocality which can be found on Google Maps, but which isn't saved by the Geo field.

Wheer to add sublocalities? To which fields of address?


Jeff VIP
Total posts: 745
24 Фев 2015 06:14

Sergey Wheer to add sublocalities? To which fields of address?

To state


Sergey
Total posts: 13,748
24 Фев 2015 14:12

Looks like it was passed to address already. Just changed to state.

Работает на Cobalt