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

Can't save Javascript in PDF form

Community Beginner ,
Apr 21, 2020 Apr 21, 2020

I have a simple Javascript that calculates the number of checked checkboxes. But after saving the file all javascripts are lost. I tried to lock, did not use the previews and did many other actions and nothing helps. What I do wrong?

UPD. Thank you all. I cancelled my plan on Adobe, because as I can understand, none can help me and technical support on Adobe does not work for non-standart cases. I will try to do my project with other tools.

TOPICS
General troubleshooting , PDF forms
2.6K
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 Expert ,
Apr 21, 2020 Apr 21, 2020

Hi,

Can you confirm the version of the software and operating system you are using?

Also, can you indicate were you are saving this document? It is possible that some protection service, like an antivirus, is trying to keep your PDFs 'clean' as it might feel your additional code could be malicious.

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 ,
Apr 21, 2020 Apr 21, 2020

Thank you for the reply!

I think I have the latest version of the Acrobat DC

Architecture: x86_64

Build: 20.6.20042.371807

AGM: 4.30.98

CoolType: 5.14.5

JP2K: 1.2.2.45402

My OS is macOS mojave 10.14.5 and I'm trying to save in the Documents folder. I have no antivirus as I know...

I'm on my free tryal week before the buying the SW, cuold it be the root of the problem?

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 Expert ,
Apr 21, 2020 Apr 21, 2020

What code does you use?

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 ,
Apr 21, 2020 Apr 21, 2020

var nSum = 0;

var aCkFlds = this.getField("CheckBox1").getArray();

 

for(var i=0;i<aCkFlds.length;i++){

  if(aCkFlds[i].isBoxChecked(0))nSum++;

}

 

event.value = nSum;

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 Expert ,
Apr 21, 2020 Apr 21, 2020

Acrobat DC on Windows doesn't remove the code.

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 ,
Apr 21, 2020 Apr 21, 2020

Same for my developer computer, but the saved file still does not work on smartphones and macs

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 Expert ,
Apr 21, 2020 Apr 21, 2020

How are you saving it, exactly? It should not cause any code to be removed.

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 ,
Apr 21, 2020 Apr 21, 2020

Just in very ordinary way, Save-as

I'd made the short screen video, all the interface is in Russian, but all functions are the same

https://youtu.be/2w2k0dY8ENA

 

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 Expert ,
Apr 21, 2020 Apr 21, 2020

Try this:

Delete the field and re-create the field with the script.

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 ,
Apr 22, 2020 Apr 22, 2020

Does not work.

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 ,
Apr 22, 2020 Apr 22, 2020

It does not work

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 Expert ,
Apr 22, 2020 Apr 22, 2020

Where in the video does you save the filled form?

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 ,
Apr 22, 2020 Apr 22, 2020

File - Save As - Choose the folder - Save

 

and tryed another way

File - Save as Other - Reader Extended PDF - Enable more tools (incl form fill-in and save) - Save now - Save

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 Expert ,
Apr 22, 2020 Apr 22, 2020

Don't fill the form in Apple Preview, it will damage the form.

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 ,
Apr 23, 2020 Apr 23, 2020
LATEST

I have read your answer on the same topic. If I dont use any previews and even open the file after saving, it looses scripts anyway.

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 Expert ,
Apr 22, 2020 Apr 22, 2020

You're exporting the PDF to another PDF using the Adobe PDF virtual printer... That is like sending it to an actual printer, so of course all the fields, scripts, etc. will be gone. Why are you doing that?

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 ,
Apr 22, 2020 Apr 22, 2020

How to do it right, that is the question 😉 

This way does not help too

Снимок экрана 2020-04-23 в 9.02.55.pngexpand image

Is there another way to make pdf form with scripts?

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