Google maps add marker by button click

how can i add a marker to the map and set its position by a click event?

Can’t be done directly in wappler I’m afraid, would need custom JS

thanks @Hyperbytes
it will be nice if it was added to wappler as its not that hard.
and its quite useful when you want the user to point a location on the map

Yes, it was discussed here.

At present you would have to add your own listener (well documented by google)

You could always add it as a feature request

That is not the same issue. im not loading any dynamic data. i want to add a simple marker. same as when you add it from the element menu and set its lat and long from a geo element.

Is this what you would like to achieve? The address is echoed to a text input while the lat and lon are echoed to hidden fields.

2019-06-07_12-25-09.mp4 (871.7 KB)

@Dave Yes
but the marker should not be shown all the time. only when a button is clicked for example.

It was raised in that post

@Dave Is that done in Wappler?

Not entirely. We modified a library from GitHub.

We used Wappler as the code editor though! :wink:

As far as I know this is not possible in Wappler directly? Whichever route is chosen some customisation will be required.

I’m sure we did this by accident… Let me have a look a little later and see if we still have that version on file…

It’s quite well documented:

Accessing Arguments in UI Events (scroll down a little)
https://developers.google.com/maps/documentation/javascript/events#EventArgume

Some sort of database write-back and query refresh could lead to some interesting possibilities.

1 Like

Thats alot of overhead for this type of stuff.