on a dynamic page i'm trying to connect the address in collection that was created with google places API using the wix user address input
I have tried several code variations as follows
let myLocation = $w("#googleMaps1").location; let txtGoogleMapsName = $w('#someDataSetName').getCurrentItem().title; let txtGoogleMapsLat = $w('#someDataSetName').getCurrentItem().latitude; let txtGoogleMapsLong = $w('#someDataSetName').getCurrentItem().longitude; $w("#googleMaps1").location = { "longitude": txtGoogleMapsLong, "latitude": txtGoogleMapsLat, "description": txtGoogleMapsName
and this one which is a mash up of the code used on the page where an address input is located with a map
in my case the address is now stored in the collection
function viewAddressOnMap(address) {
$w.onReady( function () {
$w("#dynamicDataset").onReady( () => {
let currentItem = $w("#dynamicDataset").getCurrentItem();
viewAddressOnMap(address);
$w("#googleMaps1").location = {
"latitude": address.location.latitude,
"longitude": address.location.longitude,
"description": address.formatted
};
});
thanks Adam
Can’t believe it. It’s working. I reset as dynamic page so one row works. im going for a beer or two while it’s working:) thanks for all your help. Happy new year Adam
i've deleted all records without an address and now have this error
DatasetError: Operation (onReady) not allowed on an unconfigured dataset
Member Fullname (FullName, ID)
Line 8
DatasetError: Operation (onReady) not allowed on an unconfigured dataset
Member Fullname (FullName, ID)
Line 21
this dataset is configured ?
as this is an optional field should I add a filter to the dataset settings for ltrAddress field key ?
I can delete all rows rows without this field key to test in the meantime
It picks up every field key except ltrAddress? Which is strange
Happy New year @J.D. and happy new year to Wix and all wix users
an error occurred in one of datasetReady callbacks TypeError: undefined is not an object (evaluating 'currentItem.ltrAddress.location')
I’m wondering if line 34 is the problem as the content within the fieldkey says address not location ?
Should address, latitude, longitude start with a capital A, L and L respectively ?
It’s 100% ltrAddress as fieldkey. Now do I need to declare ltrAddress somewhere as a value in the code ? Apart from
lines 35-37
great that has removed those errors thanks @J.D.
last thing to sort out is this
An error occurred in one of datasetReady callbacks TypeError: undefined is not an object (evaluating 'myLocation.latitude')
The problem is that you use semicolons instead of commas inside the object.
The selector isn't valid for the field key or google map 1 at the moment so i do not know what to enter in # as i already have the address stored in the collection
So i can see that i have to try and declare the values for latitude, longitude and location. All i'm trying to do is pull the address from the collection onto the map on the dynamic page
I think i'm getting there but let address = $w("#").value; is neither the field key (ltrAddress) or googleMaps1 and i do not have another page element ?
thanks
1. ltrAddress is fieldkey
2. and googleMaps1 is the map on the page
ltrAddress is the field key but address, latitude and longitude are sub fields within the field key
and i'm not sure how location fits with this
Thanks J.D. this is the collection field key view and the one that i'm trying to link to the map on the dynamic page
ah currentItem is for a repeater right? but this map has been placed in a slideshow