Capture User x/y Mouse Click Widget and URL Link

1823
15
Jump to solution
02-08-2019 08:50 AM
joerodmey
MVP Alum

Hi all,

Right now in WAB I have code to allow the user to click on the map, capture the x/y location, initate a popup with a link (that has the x/y location passed in), and when the link is hit fires up Survey123 to enter data.

What I want to do next is allow the user to click a button to perform this rather than have this option on "all the time".

Any ideas or samples?

Thanks,

Joe

0 Kudos
15 Replies
RobertScheitlin__GISP
MVP Emeritus

Joe,

   OK, I posted that back in February so that is years ago for me in GeoNet time. I did not create a settings dialog for the widget so it will error and spin when you add it to the app but just hit OK and then use the widget.

0 Kudos
joerodmey
MVP Alum

It worked.

Just a few questions:

-can the widget instead just be an on/off?

-Once the user clicks the widget to turn it on they can immediately click on the map and a new browser tab will open. This avoids a few clicks. Is this possible?

Thanks

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Sure. I have given you a start but I can not do all your development for you.

0 Kudos
joerodmey
MVP Alum

What areas of the code should I focus in to accomplish this?

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

For the on-off portion you would edit the manifest.json and set inPanel to false then run all your code in onOpen function (i.e. adding you map click event and then in onClose remove the click event handler. My Layer Toggle Button widget is an example of an on off widget. By the way it is probably time to mark this question as answered before you go changing/adding to the question again lol.

joerodmey
MVP Alum

Thanks!

0 Kudos