Google maps add marker by button click

#1

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

#2

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

#3

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

#4

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

#5

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.

#6

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)

#7

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

#8

It was raised in that post

#9

@Dave Is that done in Wappler?

#10

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.

#11

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…

#12

It’s quite well documented:

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

#13

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

1 Like
#14

Thats alot of overhead for this type of stuff.