Skip to main content
Participant
November 26, 2019
Question

Need help with JavaScript to create form template using buttons to show images

  • November 26, 2019
  • 1 reply
  • 1186 views

In theory, what I'm trying to do is pretty easy. But I've reached my breaking point trying to figure it out on my own. This is for a project at work that I need to figure out and have ready ASAP. Any help would be extremely appreciated.

 

Every week I am required to visit a construction site and take 35 photos from specific locations for the duration of the project. The locations from where the photos are taken do not change from week to week. Once the photos are taken they are required to be compiled into an interactive PDF that shows a map of the site with each location of where the photograph was taken designated with an icon. That icon should then be clickable to show the image that was taken from that location. I have only been tasked with this for two weeks and both times I've been able to meet their requirements but it's sloppy and labor intensive each time.

 

The first week I simply created a single PDF of the map and all 35 images, each on their own page. Then I added buttons for each image location on the map, and set the button action to show the specific page that that particular image was on. then on each image page I added a button to return back to the map page.

 

Week two I used a similar map, but instead of adding pages for each of the images, I created 35 image form fields in the center of my map that overlapped perfectly, and wrote some short Java Script for each button. For example button one, would get image field one and if it was not visible it would the field to be visible. If it was visible, it would set the field to be hidden. The problem with that is having to type the field names in every button JavaScript action, and having to manually load the icon of every image field.

 

Today I thought I had finally figured it out only to be stopped by security warnings denying access for the JavaScript to open the image files. I can't put them in the safe path because this is getting distributed to multiple different people and opening, viewing, and navigating needs to be seamless and easy.

 

The solution I'm looking for should be something like this ;

 

On  map document open, It automatically searches for images saved in the same root path and creates image fields for each file it finds. Then associate each new image field to existing buttons already on the map. Button one should toggle image one, etc so that part should be easy to come up with. I need to be able each week to simply load new image files into a folder and have the script in the map take care of the rest.

 

If there is a better solution I am all ears. Thank you for your help I am dying to get this behind me!! Sorry for any typos or gramatical errors, this was typed on my phone.

This topic has been closed for replies.

1 reply

try67
Community Expert
Community Expert
November 26, 2019

Not possible with JavaScript, as it can't search a folder for files. A plugin might be able to do it.

Participant
November 27, 2019

If a plug-in was able to do the trick, wouldn't it need to be installed on everyone's machine who needed to view it? Or would it be packaged up into the document and essentially invisible to the people who need to see it? It needs to be easy, intuitive, and right... These are state government folks we're talking about here so we'll get rejected if it isn't perfect which is holding up job payouts. Yikes! Thanks for the help though, if you have any other thoughts I'd appreciate anything else you might be able to come up with.

try67
Community Expert
Community Expert
November 27, 2019

A plugin has to be installed on the local machine, yes.