Skip to main content
Participant
January 12, 2017
Question

Acrobat Pro field properties calculations DISAPPEARING / Javascript NOT SAVING

  • January 12, 2017
  • 6 replies
  • 5581 views

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

6 replies

JR Boulay
Community Expert
Community Expert
March 17, 2025

[MOVED TO THE ACROBAT DISCUSSIONS]

Acrobate du PDF, InDesigner et Photoshopographe
Participant
August 6, 2022

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.

Participant
August 30, 2022

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.

try67
Community Expert
Community Expert
August 30, 2022

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

Participant
July 30, 2022

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

JR Boulay
Community Expert
Community Expert
February 7, 2017

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…"

Acrobate du PDF, InDesigner et Photoshopographe
try67
Community Expert
Community Expert
February 7, 2017

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

JR Boulay
Community Expert
Community Expert
February 7, 2017

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

No comment.

Acrobate du PDF, InDesigner et Photoshopographe
Participating Frequently
February 6, 2017

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;

Joel Geraci
Community Expert
Community Expert
February 6, 2017

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

We can't help you without details.

Participating Frequently
February 6, 2017

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

Joel Geraci
Community Expert
Community Expert
February 3, 2017

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