Skip to main content
aniXero
Inspiring
July 1, 2016
Répondu

Javascripts stop working on another computer

Recently bought Acrobat DC through my school. I was using Acrobat X to create everything. Wrote javascripts (and even received some help here before), and everything was working fine.

Needed to update a PDF Kit we use regularly. It uses duplicate form fields, document level scripts, and field calculation scripts.

Kit #1 - Still works. No issues there.

Kit #2 - Uses the same scripts. No javascripts are working.

- 2 radio buttons hide/unhide script was added.

---I did use the new feature to hide/unhide fields under mouse up actions first. When that didn't work I went to a javascript.

- Kits were both created on my home computer. (I work better at home and have more time. Besides, they won't give me the full version at work. It's the military, long story.)

- Emailed it to my work computer, bam nothing works.

Here's the fun part; It works just fine on my home computer. While at work the older kit still works, while the new one doesn't work at all. Reminder, scripts are the same. Acrobat says it is able to be read by all versions on both.

Pro DC: Build 006.30174

Reader at home: Reader XI

Reader at work: DC

So, what do you think? I'm stumped.

Ce sujet a été fermé aux réponses.
Meilleure réponse par aniXero

I see no scripts in DEP KIT 2-0-D. I see document level script names for "HandleRadioButtonA" and "HandleRadioButtonB" but no code has been entered for these items. When editing all code, I see no code for any of the form fields with calculations. This is like "If a tree falls in the forest and there is no one around to hear it, does it make a sound?"

If there is no code in the PDF then no code will be run. You need to add the code to the form before any code will be run.

That's odd. REALLY ODD. Because I can see the scripts on my home computer. Why would the scripts not be in there? I literally have the same file on my home computer and everything runs just the way it was intended. I downloaded the file from g-drive to a different folder see what you are talking about. And you're right, the scripts just aren't there. How could the scripts disappear?

Edited:

Ok I looked at the sent items in my Gmail and found the file. Downloaded it to a different file folder and the scripts are there.

Logged into my work email (outlook webmail) and downloaded the file from there. No scripts this time. At work I usually use the regular Outlook.

As a control, I emailed the file once more and then used the webmail to check it. No scripts.

Control #2: Uploaded from home computer to GDrive, then downloaded to separate folder. Scripts are there. I think maybe our email system is somehow stripping the scripts out. I will test by downloading from G-Drive to work computer tomorrow and follow up.


Yep. Work email was stripping out the javascript. That was the issue. Almost a whole week of going crazy and it is something simple.

13 commentaires

Legend
July 3, 2016

I really recommend you try to work out what we are talking about. These are basic and simple techniques that will help you solve your problems. All programmers hit the "doesn't seem to do anything" wall and we need techniques to understand what's wrong. If you dismiss this has too hard you will never be able to progress.  Try working through either one of the last two replies. My tips:

1. Read it through, see if you get any sense from it

2. Try and follow the details one by one

3. Work in order, don't jump around. Crucial.

4. If there's a bit you don't understand, stop. Work out what you do understand, and ask us. Ask us in context, tell us what you know and what you think it might mean.

5. If someone sughests you read documentation, do so. If it isn't clear, say. Programmers (unlike normal people) are expected to be able to read and use documentation.

6. Never expect people to write even one line of code for you. I see our job as helping you understand enough to write that line - and many more.

Inspiring
July 1, 2016

Is JavaScript enabled on the second computer?

If you add some code to use an "app.alert" to indicate the code has been added, does it work?

Are you allowed to add code to your work computer?

What will happen if the IG finds your code during an inspection or audit?

You really might want to ask for permission and not forgiveness in this case.

aniXero
aniXeroAuteur
Inspiring
July 2, 2016

1. Yes javascript is enabled. The previous pdf kit uses it as well. No issues there. It operates normally as programmed. The new kit uses a lot of the same programming to calculate dates. Only difference is that I added a radio button to give the option of using handwritten dates. It only hides or unhides the fields specified.

2. Not sure what you mean on the app.alert. I am a mediocre programmer. I know some, but not as much as I want too.

3. No. Funding prevents me from having the full version of Acrobat DC on the work computer.

4. Nothing. Javascript enabled pdf files are used all the time. I just more or less stripped out theirs and combined multiple files and then programmed it all to work for everyone. Saves everyone a whole lot of time from downloading all the files, filling in each form, and then printing it all.

5. Chain of command knows about it. They would like me to finish the newest revision to bring it in line with current instructions then route up to the top dogs for nationwide approval.

Legend
July 2, 2016

You will find app.alert in the API reference (let us know if you need help finding it). It is a useful trick for programmers trying to solve problems. It pops up a message. So you can use it to see if your code is being used or ignored, as well as report to see what values you have. These things are added for testing only, and removed once working.

Inspiring
July 1, 2016

Have you checked the JavaScript console t o see if any errors are reported?

aniXero
aniXeroAuteur
Inspiring
July 2, 2016

No errors are reported. Not to mention everything works as programmed on my home computer.