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

calculate subtotal fields

New Here ,
Feb 12, 2019 Feb 12, 2019

Copy link to clipboard

Copied

I've created a form where our technicians can select one of three boxes for courses they are required to take. Depending on the box they select a field will either populate with $0 or a specific dollar amount. I now want to add the fields with the dollar amounts and I can't get adobe to do that for me.

Here is the sample script I'm using based on something I found online: event.value=this.getField(“Text37”).value+this.getField(“Text38”).value;

It's not wrking. Any help would be greatly appreciated.

TOPICS
Acrobat SDK and JavaScript , Windows

Views

243

Likes

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

correct answers 1 Correct answer

Community Expert , Feb 12, 2019 Feb 12, 2019

Sounds like the file got corrupt. Did you at any point edit the scripts via the Edit All JavaScripts command?

Likes

Translate

Translate
Community Expert ,
Feb 12, 2019 Feb 12, 2019

Copy link to clipboard

Copied

Use this:

event.value=Number(this.getField("Text37").value)+Number(this.getField("Text38").value);

Likes

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 ,
Feb 12, 2019 Feb 12, 2019

Copy link to clipboard

Copied

PS. Or you can simply use the built-in Sum command in the Calculate tab and then select Text37 and Text38 from the list...

Likes

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 ,
Feb 12, 2019 Feb 12, 2019

Copy link to clipboard

Copied

I tried using both, but what happens is when I click “okay” after making the selections or entering the script, the box closes and the script or selections disappear as if I never entered anything in the first place…like this:

Thanks,

Janette

Likes

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 ,
Feb 12, 2019 Feb 12, 2019

Copy link to clipboard

Copied

You can't use both. Either one or the other.

And if you tried attaching a screenshot it didn't come through. Reply directly from the forum and use the Insert Image icon. Don't attach the image to an email.

Likes

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 ,
Feb 12, 2019 Feb 12, 2019

Copy link to clipboard

Copied

I can't use either - nothing stays in the boxes so it's impossible to use both at the same time. Here's a picture of what I've entered in the calculation script box and another showing that's disappeared after I click OK. Very frustrating!Shows calculation entry.jpgResult after clicking OK.jpg

Likes

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 ,
Feb 12, 2019 Feb 12, 2019

Copy link to clipboard

Copied

Sounds like the file got corrupt. Did you at any point edit the scripts via the Edit All JavaScripts command?

Likes

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 ,
Feb 12, 2019 Feb 12, 2019

Copy link to clipboard

Copied

LATEST

You're right. I uninstall acrobat then re-installed it - problem solved. It's behaving properly now. Thanks for your help!

Likes

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