Skip to main content
Participant
Jan 12, 2017 10:40 PM UTC
Question

Acrobat Pro field properties calculations DISAPPEARING / Javascript NOT SAVING

Dear Adobe Community,

I made a form with calculations under text field properties. 

(They are all basic algebra )

1 is a custom calculation script, and the other 2 are simplified field notations (basic addition)

The calculation scripts are simply not always saving.  If I make a new PDF off the old one - and save it w/a new name - while most field properties remain - the calculation scripts do not always save.   Sometimes they do, sometimes they dont.

Even more bizzare - I have the PDF open now.  The calculations are there.   I close it (w/o saving), reopen it - and 1 of the calculatins is gone.  Then i do the same thing, this time A DIFFERENT calculations is gone. 

Really pulling my hair out.

Please help...thank you!

Here are the calculations:

(function () { 

 

    // Get the values of the text fields, as numbers 

    var v1 = +getField("FillText13").value; 

    var v2 = +getField("FillText14").value; 

 

    // Set this field's value based on the state of the check box named "CB" 

    if (getField("FillText16").value !== "Off") { 

        event.value = v1 - v2; 

    } else { 

        event.value = v1; 

    } 

 

})();

(function () {

var sStart = getField("FillText40").valueAsString;

var sEnd = getField("FillText46").valueAsString;

var dStart, dEnd, diff;

if(sStart && sEnd) {

dStart = util.scand("m/d/yy", sStart);

dEnd = util.scand("m/d/yy", sEnd);

diff = dEnd.getTime() - dStart.getTime();

event.value = Math.floor(diff / 864e5) / 30;

} else {

event.value = "";

}

})();

FillText16 + FillText17 + FillText25 + FillText26 + FillText33   

FillText27 * .10 / 12 * xy

23 replies

JR Boulay
Community Expert
Community Expert
Mar 17, 2025 1:52 PM UTC

[MOVED TO THE ACROBAT DISCUSSIONS]

Translate
Acrobate du PDF, InDesigner et Photoshopographe
Participant
Aug 6, 2022 12:43 AM UTC

Alright well, 5 year old post, I know, but I ahve been having the exact same issue, and it has driven me absolutely crazy. I look at a field one minute and the script is there, then I do something else in another tab, come back, and its gone. Also have the same thing with opening a file and different fields are missing each time.

 

Anyways, for the sake of posterity im posting how I think I might have solved the problem here, for anyone like me whos losing their minds over this. All I did was click the "locked" checkbox in the properties tab, and none of them have dissapeared again so far. It sounds self explanatory when I say it that way, but It makes no sense to me why you should have to lock the properties in order to prevent a script from deleting itself. Its absolutely silly, and in no place in all the official Adobe literature ive dug though on the subject does it ever say that you have to do that. This issue has clearly been around for like at least 5 years now and its no small issue. It completely breaks PDFs, yet somehow it hasnt been fixed.

Translate
Participant
Aug 30, 2022 3:43 PM UTC

Worthless company... I am having the issue I put the code in and when I hit OK it goes back up to "value is not calculated" not even giving me the chance to lock it.

Translate
try67
Community Expert
Community Expert
Aug 30, 2022 4:04 PM UTC

Does you code contain the string "AF", by any chance?

Translate
Participant
Jul 30, 2022 7:13 PM UTC

Make sure you're signed in to your Adobe account.

Translate
JR Boulay
Community Expert
Community Expert
Feb 7, 2017 10:18 AM UTC

Hi.

There are some tips in Acrobat to not draw fields one by one.

In Edition mode, right-clic on any form field and choose "Duplicate…" or "Create multiple…"

Translate
Acrobate du PDF, InDesigner et Photoshopographe
try67
Community Expert
Community Expert
Feb 7, 2017 10:23 AM UTC

And of course one should always use the Fields Detection Wizard. It usually produces decent enough results, as a starting point...

Translate
JR Boulay
Community Expert
Community Expert
Feb 7, 2017 12:09 PM UTC

It usually produces decent enough results, as a starting point...

No comment.

Translate
Acrobate du PDF, InDesigner et Photoshopographe
Participating Frequently
Feb 6, 2017 10:05 PM UTC

I am having a similar issue. I click on the edit button to add my script, enter the script, hit okay and not only is it not saving my script to the display area, but also moves the radio button to "Value is not calculated"

Very frustrating.

Script I am using:

event.value = getField("A-OG-CDA-SAVE 001").value * getField("B-WGHT-CDA-SAVE 001").value;

Translate
Joel Geraci
Community Expert
Community Expert
Feb 6, 2017 10:07 PM UTC

Platform? Acrobat version number? Using external editor or not?

We can't help you without details.

Translate
Participating Frequently
Feb 6, 2017 10:10 PM UTC

Windows 10, Acrobat Pro DC Version 2015.023.20056, not using an external editor.

Translate
Joel Geraci
Community Expert
Community Expert
Feb 3, 2017 7:25 PM UTC

Are you using the native JS editor or an external editor?

Translate