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

Acrobat Pro field properties calculations DISAPPEARING / Javascript NOT SAVING

New Here ,
Jan 12, 2017 Jan 12, 2017

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

4.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
Community Expert ,
Feb 03, 2017 Feb 03, 2017

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

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 ,
Feb 06, 2017 Feb 06, 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;

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 ,
Feb 06, 2017 Feb 06, 2017

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

We can't help you without details.

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 ,
Feb 06, 2017 Feb 06, 2017

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

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 ,
Feb 06, 2017 Feb 06, 2017

Recorded the problem on my phone and uploaded to YouTube. I have been making forms for years and never had this issue before. Tested the other calculation fields as well get the same result of the radio button defaulting to "Value is not calculated"

http://www.youtube.com/watch?v=Ta_Vuv_GjIA

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 ,
Feb 06, 2017 Feb 06, 2017

Wow!!!! That video was incredibly helpful... unfortunately, I can't reproduce the problem. I'm going to guess that either the field you're editing is corrupt or one of it's input fields is corrupt.

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 ,
Feb 06, 2017 Feb 06, 2017

Thanks for your quick responses and attention Joel and Try67.

I was afraid there might be an underlying issue with the export from InDesign. I'll keep trying and see what I can find out. Deleting 174 fields and recreating them makes me want to cry.

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 ,
Feb 06, 2017 Feb 06, 2017

Ah, you created the fields in ID... That might explain it. I've encountered a lot of problems with these fields and always recommend to people to only do the layout in ID and create the fields themselves in Acrobat. Try doing a test with this one field by deleting it, saving the file, closing it, reopening it and then adding the field again (in Acrobat!) and seeing if the calculation works then.

This is a major bug of InDesign and Adobe really should have solved it a long time ago...

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 ,
Feb 06, 2017 Feb 06, 2017

Wait... the fields were added to the PDF by InDesign? InDesign is great for creating interactive PDF when it's creating the final version. Without going into detail as to why, adding form fields via InDesign just isn't something I'd do if your intention is to further edit them in Acrobat.

I'm not going to elaborate. Just... don't. SMH No.

J-

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 ,
Feb 06, 2017 Feb 06, 2017

LOL. Since I am designing the form in InDesign I create text fields as well because its faster than drawing them in Acrobat and also I'm OCD and it looks uniform and better from InDesign.

I'm not that good at scripting so before I was selecting fields using Acrobat's "Value is the [Product] of the following fields:" area, but after having the same issue from my video I looked up scripts to try that. Here is the work-flow if you were remotely curious:

Since you can't choose further field options in ID once I export to PDF I change all the fields to number format, then apply the calculations. In this case, I was doing it the hard way and creating a hidden field containing a predetermined weight, then I create a second hidden field that calculated a quantity field with the hidden weight field. Lastly, a field at the top of each page of the form adds all the calculated hidden fields to show a total weight for the form.

I'm going to try to create the fields manually in Acrobat, other than the quantity field, and see if this will help remedy the issues with the calculate tab as Try67 suggested. If it doesn't then I'll go to manually drawing all the fields and go from there. I haven't had issues until today with ID > PDF and I have been doing it for 7+ years. (the process for pre version 2015 was much more head shaking but still quicker work-flow wise)

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 ,
Feb 06, 2017 Feb 06, 2017

Ok good - I was afraid you were going to say Acrobat 9 or something...  I live and breath inside the JavaScript editor in DC and I'm not having any trouble with scripts not saving. In addition to what try67 suggested, try adding "this." to your "getField" method... as in...

this.getField("A-OG-CDA-SAVE 001").value

It's possible that the JavaScript verifier isn't liking your shorthand.

J-

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 ,
Feb 06, 2017 Feb 06, 2017

Try deleting the field and then re-creating it.

If that doesn't work you can always apply the code using a script from the JS Console, like this:

this.getField("FieldName").setAction("Calculate", "event.value = getField(\"A-OG-CDA-SAVE 001\").value * getField(\"B-WGHT-CDA-SAVE 001\").value;");

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 ,
Feb 07, 2017 Feb 07, 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 Photoshoptographe
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 ,
Feb 07, 2017 Feb 07, 2017

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

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 ,
Feb 07, 2017 Feb 07, 2017

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

No comment.


Acrobate du PDF, InDesigner et Photoshoptographe
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
New Here ,
Jul 30, 2022 Jul 30, 2022

Make sure you're signed in to your Adobe account.Screenshot 2022-07-30 120737.pngexpand image

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
New Here ,
Aug 05, 2022 Aug 05, 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.

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
New Here ,
Aug 30, 2022 Aug 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.

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 ,
Aug 30, 2022 Aug 30, 2022

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

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
New Here ,
Jan 29, 2024 Jan 29, 2024

2024 and still the same problem.

I have to keep old versions of my forms so I can copy and paste when the scripts disappear.

 

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
New Here ,
Mar 15, 2025 Mar 15, 2025

Not sure, but looks like if you have the javascript window on on the form window (especially on the different screen) it will not save the java 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
Adobe Employee ,
Apr 03, 2025 Apr 03, 2025
LATEST

Hello!

 

​If you're encountering issues in Adobe Acrobat Pro where form field calculations or JavaScript scripts are not saving or are disappearing, consider the following steps to resolve the problem:

Recreate the Form Field: Delete the problematic field: In Acrobat, go to Tools > Prepare Form. Select the field, right-click, and choose Delete. Save and close the document. Reopen the document and recreate the field: Use the Prepare Form tool to add a new field. Assign a unique name to the new field. Re-enter the calculation script or set the desired properties.

Use Native Editor: Ensure you are using the native JavaScript editor within Acrobat, not an external editor. Ensure Adobe Acrobat Pro is updated to the latest version. 

 

To learn more, see this article: https://adobe.ly/4iTROO7

 

Thanks,

Anand Sri.

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 ,
Mar 17, 2025 Mar 17, 2025

[MOVED TO THE ACROBAT DISCUSSIONS]


Acrobate du PDF, InDesigner et Photoshoptographe
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