Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Javascripts stop working on another computer

Community Beginner ,
Jun 30, 2016 Jun 30, 2016

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.

TOPICS
Acrobat SDK and JavaScript , Windows
1.5K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Beginner , Jul 05, 2016 Jul 05, 2016

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

Translate
LEGEND ,
Jun 30, 2016 Jun 30, 2016

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jul 01, 2016 Jul 01, 2016

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 01, 2016 Jul 01, 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jul 01, 2016 Jul 01, 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 02, 2016 Jul 02, 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 02, 2016 Jul 02, 2016

A noted, this is one method to see if the .js file you have installed is being processed. Other tools include writing messages to the JavaScript console, using the JavaScript console to debug by stepping through each line of code, examining the variables, etc, using the "try" statement to trap errors and display the error message or other information.

You can copy the code you are trying to install into a cleared JavaScript console, select all the code, hold down the <Ctrl> key and press the key pad <Enter> key or the <Enter> key. This will execute all of the code and the functions will now be available for as long as Acrobat is opened.

All of this is to verify that your code works and is being installed in the correct folder.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jul 02, 2016 Jul 02, 2016

I'm going to be honest with you, I have no idea what you're talking about. I write something, I get some help in fixing it, and/or I keep trying things until I get the result I'm looking for.

If it works, I move on. If not, well I keep trying. I'm really just starting out doing this. I don't have any training other than hands on what I have done so far. I have no clue about any tools, programs, etc that are available to me.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 03, 2016 Jul 03, 2016

Your debugging will go much faster if you know how to use the tools to help isolate your problem and show you what are not seeing.

See Thom Parker's "where is" series by Thom Parker

The Acrobat JavaScript Console (Your best friend for developing Acrobat JavaScript) by Thom Parker

https://acrobatusers.com/tutorials/how-to-debug-your-script

How to debug your script using Acrobat 9 by Thom Parker

Using the JavaScript Debugger console

JavaScript for Acrobat API Reference

MDN JavaScript

QED Guides Acumen Training

You can use the "typeof" operator to see if your function has been defined or not.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jul 04, 2016 Jul 04, 2016

Ok so if I'm doing it correctly I am not coming up with any errors.

Some other info:

Kit #1 was created with Adobe Acrobat XI.

Kit #2 was created with DC.

Both files are located in the same folder on the work computer (where I don't have Acrobat just Reader). Folder has also been marked as a trusted folder.

If possible can you check to see if they work for you? 1.91 should have no problem, I'm really worried about 2.0.D.

Here is the G-Drive address to both files:

Kits

What is killing me is that the javascripts just don't execute at all on the other computer. None of them do.

Age Calculation based on birth date.

--If calculated age is 17 then a field is supposed to unhide.

"Put together" script for name (Last Name + First Name + Middle Name)

Dates calculation based on two different dates.

None of them work. Even the ones that worked in the previous kit.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 04, 2016 Jul 04, 2016

We have to work only  on your description of how you are implementing the scripts and what the code is soposed to be doing. In my experience, none of the code to compute ages or compare dates has changed much since version 4.01.

The user folder where scripts need to be placed was changed with version 10.1. The application's JavaScript folder has not changed except for the bit level and product name. You can still get the application JavaScript folder name using the JavaScript console and the app.getPath method.

Without seeing the code and knowing the exact version of Acrobat/Reader.

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.

Since the DEP KIT 1-91 Protected computes the age from the date of birth it appears all the code is within the PDF with no special code in the application JavaScript or user JavaScript folder.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jul 04, 2016 Jul 04, 2016

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jul 05, 2016 Jul 05, 2016
LATEST

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 03, 2016 Jul 03, 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines