5 Replies Latest reply on Oct 25, 2017 2:36 PM by try67

    Using Acrobat Pro DC, issues with javascript saving

    chrisj2359947

      I am using Acrobat Pro DC to make a form. The form has a section that is divided into 2 areas which are controlled by radio buttons that are in the same group. When radio1 is selected we want the entry fields in area 1 visible and the entry fields in area 2 hidden. And when radio 2 is selected we want the entry fields in area 2 visible and the entry fields in area 1 hidden. We are using javascript on mouse up actions to accomplish this in acrobat. Everything is working as expected in the preview in acrobat. My issue is that in the saving process it seems that all the javascript is being stripped out. When I go to reopen the file in Acrobat pro, all the fields are still there but there is no javascript attached to them. Is there something that needs to be done or set for the javascript to be saved at the field level?

        • 1. Re: Using Acrobat Pro DC, issues with javascript saving
          try67 MVP & Adobe Community Professional

          Not really... However, it's not possible to save a file using a script that's only located within that file itself. It requires placing a trusted function in a folder-level script and then calling it from the script that's in your field, but that's another issue.

          Are you editing the code using the Edit All JavaScripts window, by any chance? If so, don't!

          • 2. Re: Using Acrobat Pro DC, issues with javascript saving
            chrisj2359947 Level 1

            I am not using the Edit All Javascripts window. I am entering the scripts within the actions tab on the field's properties panel. I am then saving the file like you normally would with the file-> save. So the script is not saving anything, it's just that the script I am writing in the actions tab to hide/show the desired fields is not being saved.

            • 3. Re: Using Acrobat Pro DC, issues with javascript saving
              try67 MVP & Adobe Community Professional

              Very strange... Can you post your script and/or share your file?

              • 4. Re: Using Acrobat Pro DC, issues with javascript saving
                chrisj2359947 Level 1

                Firstly, thank you for the help.

                 

                 

                you can see how I am adding the script above.

                 

                but once saved and reopened it looks like this:

                 

                The script on the "rate" radio button is:

                 

                this.getField("rateAmount").display = display.visible;

                this.getField("rateClass").display = display.visible;

                this.getField("rateCheck1").display = display.visible;

                this.getField("rateCheck2").display = display.visible;

                this.getField("rateCheck3").display = display.visible;

                 

                 

                if(this.getField("rateCheck1").value == "Yes"){

                     this.getField("rateTotalHr").display = display.visible;

                }

                if(this.getField("rateCheck2").value == "Yes"){

                     this.getField("rateTotalDol").display = display.visible;

                }

                if(this.getField("rateCheck3").value == "Yes"){

                     this.getField("rateAsNeed").display = display.visible;

                }

                this.getField("stipendTotal").display = display.hidden;

                this.getField("stipendMonths").display = display.hidden;

                this.getField("stipendInstall").display = display.hidden;

                this.getField("stipendPaid").display = display.hidden;

                • 5. Re: Using Acrobat Pro DC, issues with javascript saving
                  try67 MVP & Adobe Community Professional

                  My guess is the file got corrupt somehow. If you have an earlier version of it I suggest you go back to it and try it again.