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

Using Acrobat Pro DC, issues with javascript saving

New Here ,
Oct 25, 2017 Oct 25, 2017

Copy link to clipboard

Copied

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?

TOPICS
Acrobat SDK and JavaScript

Views

428

Translate

Translate

Report

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 ,
Oct 25, 2017 Oct 25, 2017

Copy link to clipboard

Copied

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!

Votes

Translate

Translate

Report

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 ,
Oct 25, 2017 Oct 25, 2017

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

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 ,
Oct 25, 2017 Oct 25, 2017

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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 ,
Oct 25, 2017 Oct 25, 2017

Copy link to clipboard

Copied

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;

Votes

Translate

Translate

Report

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 ,
Oct 25, 2017 Oct 25, 2017

Copy link to clipboard

Copied

LATEST

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.

Votes

Translate

Translate

Report

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