Category: Widget
Updated

This solution is summarized from an archived support forum post. This information may have changed. If you notice an error, please let us know in Discord.

Map Select One Location

Issue

I need to allow the user to pick a single location on a map, but the current option creates a new marker every time they tap the map. I want to re-use the same marker if they pick a new location. I asked for advice and was told to enable the onMarkerCreated event and store the value of the marker as "loc". Then, in the default markers, I can read this value to ensure that it always only has the last marker that was created. It works great!

Resolution


When you enable create marker, you can set the onMarkerCreated event to store the value of the marker that was created as {{storeValue('loc',Map1.selectedMarker)}}, and then, in the Default markers, you can make it read this value to ensure that it always only has the last marker that was created

[
  {{appsmith.store.loc}}
]