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

Java Scrip code to refresh the existing codes

Contributor ,
Dec 20, 2022 Dec 20, 2022

I have several pdf fillable forms, and they contain javascript code.
When sent it to users using Adobe Acrobat on (Mac), these codes don't work!;
When sent it to users using Adobe Acrobat on (Windows), these codes work.
If there is a solution to make the code work perfectly in a Mac environment, that would be great.
But I think this is difficult, and because these forms, in the end, will be filled in, and then returned to the sender, who has a Windows system is there a (document-level-code) or a button code, to make the form (that the Mac users send) to refrest its code as soon as it is received?

Because when I receive the file some fields are empty, so I have to press again on check boxes, or re-enter the data again to make the code works.

I tried this code in the document level, but it did not work:

 

calculateNow()

 

In my form I have some calculations and this code:

 

this.getField("a_1").checkThisBox(0, (event.value == 3));
this.getField("a_2").checkThisBox(0, (3 < event.value) && (event.value < 6 ));
this.getField("a_3").checkThisBox(0, (event.value == 6));
this.getField("a_4").checkThisBox(0, (6 < event.value) && (event.value < 9 ));
this.getField("a_5").checkThisBox(0, (event.value == 9));
this.getField("a_6").checkThisBox(0, (9 < event.value) && (event.value < 11 ));
this.getField("a_7").checkThisBox(0, (event.value == 11));
this.getField("a_8").checkThisBox(0, (11 < event.value) && (event.value < 14 ));
this.getField("a_9").checkThisBox(0, (event.value == 14));
this.getField("a_10").checkThisBox(0, (14 < event.value) && (event.value < 17 ));
this.getField("a_11").checkThisBox(0, (event.value == 17));
this.getField("a_12").checkThisBox(0, (17 < event.value) && (event.value < 19 ));
this.getField("a_13").checkThisBox(0, (event.value >= 19));

 

 

Note: Some text-fields contain both codes and calculations (equations) at the same time

 

THANK YOU♥


Cheers,
Saher

TOPICS
How to , JavaScript , PDF forms , Standards and accessibility
1.7K
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
1 ACCEPTED SOLUTION
Community Expert ,
Dec 21, 2022 Dec 21, 2022

This will work in Acrobat Reader and Adobe Acrobat on Windows or Mac.

View solution in original post

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 ,
Dec 20, 2022 Dec 20, 2022

What calculations 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
Contributor ,
Dec 20, 2022 Dec 20, 2022

 

Very short, Picking fields to sum them

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 ,
Dec 20, 2022 Dec 20, 2022

Where does you use the posted 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
Contributor ,
Dec 20, 2022 Dec 20, 2022

Custom validation 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 Expert ,
Dec 21, 2022 Dec 21, 2022

This will work in Acrobat Reader and Adobe Acrobat on Windows or Mac.

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
Contributor ,
Dec 21, 2022 Dec 21, 2022

In fact it was iOS (iPad and iPhone), not macOS

This means that there is a difference

But why do the codes or the calculations freeze when the file is sent to me? And I have to refresh them manually by clicking on some check boxes!

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 ,
Dec 22, 2022 Dec 22, 2022

May be that the form was filled with a other app.

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 ,
Dec 20, 2022 Dec 20, 2022

Acrobat JavaScript is the same on Mac. Have you tested it yourself on a Mac?

A common problem on Mac is that users open in the system app "Preview" rather than Acrobat. Ask for a screen shot of the complete screen including menu bar to check this. The app name is at top left.

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
Contributor ,
Dec 20, 2022 Dec 20, 2022

In fact I did not test it myself, that's a good point, gonna ask them

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
Contributor ,
Dec 21, 2022 Dec 21, 2022

They told me they used it on iOS (iPad and iPhone), not macOS, but in Adobe Reader

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
Contributor ,
Dec 28, 2022 Dec 28, 2022
LATEST

I found this answer:

SaherNaji_0-1672248609505.pngexpand image

 

I did not know that there is a difference between iOS and macOS regarding Adobe Reader.

So the problem is that the forms fillied in using Adobe Acrobat installed on iOS (iPad) or (iPhone), then the user sends the forms again to me, the JavaScript codes remain, but it seems frozen, so I have to click on some checkboxes to force the codes to run.
I did not test it on macOS yet, but I think it will work

 

So is there a code which I can run it using a button to refresh the codes and calculations again in my Windows system?

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