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

Adobe Pro DC simple question.

New Here ,
Mar 21, 2016 Mar 21, 2016

Copy link to clipboard

Copied

Hi all,

I am new to Adobe Acrobat DC, and I am sure this is something simple, but I have very little JavaScript "know-how."  I am working on something for work and I am looking to use some sort of conditional formula.  Below is a brief description of what I am trying to do:

I have a form and I would like to sum up a range of text boxes across, but only if the first text box is not empty.  (i.e.  Text Box 1 has the date in it, so now I would like Text Boxes 2-10 to sum up in Text Box 11)

I mostly work with Excel, and as I said I am somewhat new to scripting so any help would be greatly appreciated.

Also, if anyone has any suggestions for resources I could use to learn more about JavaScript and its uses within Adobe Acrobat DC.

Thanks all,

TOPICS
Acrobat SDK and JavaScript , Windows

Views

568

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 , Mar 21, 2016 Mar 21, 2016

You can use something like this as the custom calculation script of "Text Box 11":

if (this.getField("Text Box 1").valueAsString=="") event.value = "";

else {

    var total = 0;

    for (var i=2; i<=10; i++)

          total+=Number(this.getField("Text Box "+i).value);

    event.value = total;

}

Votes

Translate

Translate
Community Expert ,
Mar 21, 2016 Mar 21, 2016

Copy link to clipboard

Copied

You can use something like this as the custom calculation script of "Text Box 11":

if (this.getField("Text Box 1").valueAsString=="") event.value = "";

else {

    var total = 0;

    for (var i=2; i<=10; i++)

          total+=Number(this.getField("Text Box "+i).value);

    event.value = total;

}

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 ,
Mar 22, 2016 Mar 22, 2016

Copy link to clipboard

Copied

LATEST

Thank you all for the responses!  I will definitely check out the resources you mentioned.  Try67, thank you for the code!  It is doing exactly what I wanted!!

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
LEGEND ,
Mar 21, 2016 Mar 21, 2016

Copy link to clipboard

Copied

There are a lot of JavaScript-related tutorials at acrobatusers.com. Be sure to get the free Acrobat SDK, which includes the Acrobat JavaScript documentation: Adobe - Acrobat Developer Center | Adobe Developer Connection

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
Engaged ,
Mar 21, 2016 Mar 21, 2016

Copy link to clipboard

Copied

The pdfscripting.com site is, in my opinion, the best resource for learning Acrobat JavaScript. Much of it is free, certainly enough to get you started is free, and when you get into the advanced stuff, the membership area will save you a lot of time not reinventing the wheel. I've been programming in Acrobat JavaScript for over a decade and I still refer to pdfscripting.com for some stuff.

J-

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