5 Replies Latest reply on Jul 30, 2008 12:55 PM by George_Johnson

    Calculation Script... won't run after restart of acrobat

      I added a custom calculation script to a field. Works like a charm.

      However if I restart acrobat the script refuses to run. I go in and confirm the script is there.

      If i go in an just add a space or a comment to the script it will start running again.

      Any ideas?

      I also saved the PDF and opened it in reader on another machine. Won't run there.

      So I attached it to an onfocus event and that seems to work fine after saving??

      So I then tried adding a "simplified field notation" and the same behavior exists there. If i restart acrobat the only way i can get the simple notation to run is if I remove it and then re-add it. Otherwise it does nothing.

      Am I missing something obvious?

      Thanks in advance.
        • 1. Re: Calculation Script... won't run after restart of acrobat
          George_Johnson MVP & Adobe Community Professional
          A calculation that is attached to a particular field gets triggered whenever some other field value changes. Merely opening a document does not normally cause a field value to change, so no calculations are triggered.

          What does your script do?

          George
          • 2. Re: Calculation Script... won't run after restart of acrobat
            Level 1
            George,

            I wasn't clear enough. The script does nothing. Editing values of text boxes that would trigger the calculation to occur will not run until after I have edited the script. (something as silly as just adding a comment will cause it to work again)

            For the simple calculation I need to remove it completely and add it again before it will work

            Here is an example for a net worth box:

            Add to "simple field notation"

            assets - liabilities

            Then I hit ok and whenever I add in some liabilities or assets those 2 fields are updated and my networth field is updated. Thats works great

            I save the file and then open it back up and add some liabilies/assets and the fields I used the built in "sum" function on continue to work (assets and liabilities) however my "simple field notation" does not update my networth field.

            I go back into field designer and verify that the simple field calculation radio box is still selected and that it still says

            assets - liabilities

            It continues not to run. I then go back in and edit it to remove the calculation.

            I then open it up again and select "simple field notation" and type in

            assets - liabilities

            This then works immediately and i am happy again until i save/restart acrobat (or try to open the PDF on another PC)

            Then I am sad again because the script doesn't run.

            I tried all these same steps with a JavaScript too. It will work until acrobat is restarted. If i edit the script by adding a space or comment it will start running again.

            So frustrating! Any help is appreciated.
            • 3. Re: Calculation Script... won't run after restart of acrobat
              George_Johnson MVP & Adobe Community Professional
              One thing you should do is check that the field calculation order makes sense for your form. Is this the only calculated field you've set up, or are there others?

              George
              • 4. Re: Calculation Script... won't run after restart of acrobat
                Level 1
                George,

                it is a calculation of other calculated fields. Would checking the calculation order fix my problem? What doesn't make sense is when i add the script to an "onfocus" event it works fine. Also why would the order change when I edit the script (causing it to work?)

                I'll check the order and make sure its last if I can find that option in the UI and report back

                Nick
                • 5. Re: Calculation Script... won't run after restart of acrobat
                  George_Johnson MVP & Adobe Community Professional
                  > Would checking the calculation order fix my problem?

                  Yes, that's the first thing to check. Do not use the onfocus event. Calculated fields should be set to read-only so users cannot attempt to enter data in them. They should not be able to receive the focus.

                  George