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

Run a calculation script on import

New Here ,
Jun 04, 2019 Jun 04, 2019

Copy link to clipboard

Copied

I have a script in a field that takes 3 other fields and formats them into 1 address field that is formatted nicely.

Works great if the user is inputting them in but I would like it to work if I import data into those 3 fields - but it is not.

Code is below. I have this as a calculation script:

event.value = this.getField("shipper_name").value + "\n"

+ this.getField("shipper_address1").value + "\n";

if (this.getField("shipper_address2").value!="")

    event.value += this.getField("shipper_address2").value + "\n";

event.value += this.getField("shipper_city").value + ", "

+ this.getField("shipper_state").value

+ " " + this.getField("shipper_postal_code").value;

I figure it has to do because the script is triggered only after the field is existed and when importing no field is getting entered/exited - therefore the script does not run.

Is there a way to have the script trigger when the data is imported or maybe when the file is opened?

TOPICS
Acrobat SDK and JavaScript

Views

211

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 ,
Jun 04, 2019 Jun 04, 2019

Copy link to clipboard

Copied

LATEST

When the data is imported: Only if you do it using a script.

When the file is opened: Sure. Add this code as a doc-level script (not inside a function):

this.calculateNow();

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