calculating checkboxes (not fields) in Adobe Acrobat XI Pro

New Here ,
May 02, 2019 May 02, 2019

Copy link to clipboard

Copied

Can someone please help me?  I need to know how to calculate checkboxes (not fields), when two or more checkboxes have been chosen in Adobe XI Pro.  I'm totally lost.

This is what I have so far, but I can’t get them to calculate.

event.value=0

if (this.getField("CheckBox1").value!="Off")event.value=95; if (this.getField("CheckBox2").value!="Off")event.value=200; if (this.getField("CheckBox3").value!="Off")event.value=525; if (this.getField("CheckBox4").value!="Off")event.value=647; if (this.getField("CheckBox5").value!="Off")event.value=617; if (this.getField("CheckBox6").value!="Off")event.value=800; if (this.getField("CheckBox7").value!="Off")event.value=65; if (this.getField("CheckBox8").value!="Off")event.value=65; if (this.getField("CheckBox9").value!="Off")event.value=65; if (this.getField("CheckBox10").value!="Off")event.value=95; if (this.getField("CheckBox11").value!="Off")event.value=148; if (this.getField("CheckBox12").value!="Off")event.value=525; if (this.getField("CheckBox13").value!="Off")event.value=560; if (this.getField("CheckBox14").value!="Off")event.value=800; if (this.getField("CheckBox15").value!="Off")event.value=65; if (this.getField("CheckBox16").value!="Off")event.value=65; if (this.getField("CheckBox17").value!="Off")event.value=105; if (this.getField("CheckBox18").value!="Off")event.value=95; if (this.getField("CheckBox19").value!="Off")event.value=65; if (this.getField("CheckBox20").value!="Off")event.value=525; if (this.getField("CheckBox21").value!="Off")event.value=572; if (this.getField("CheckBox22").value!="Off")event.value=1,000; if (this.getField("CheckBox23").value!="Off")event.value=65; if (this.getField("CheckBox24").value!="Off")event.value=65; if (this.getField("CheckBox25").value!="Off")event.value=105; if (this.getField("CheckBox26").value!="Off")event.value=95; if (this.getField("CheckBox27").value!="Off")event.value=65; if (this.getField("CheckBox28").value!="Off")event.value=525; if (this.getField("CheckBox29").value!="Off")event.value=1,200; if (this.getField("CheckBox30").value!="Off")event.value=65; if (this.getField("CheckBox31").value!="Off")event.value=65; if (this.getField("CheckBox32").value!="Off")event.value=105; if (this.getField("CheckBox33").value!="Off")event.value=150; if (this.getField("CheckBox34").value!="Off")event.value=180; if (this.getField("CheckBox35").value!="Off")event.value=180;

I don’t know what to use here.

newTotal=(this.getField("CheckBox1")e.value+this.getField("CheckBox2")e.value;

  1. event.value=newTotal);

[ moved from Forum comments to JavaScript by moderator ]

TOPICS
Acrobat SDK and JavaScript

Views

121

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
Most Valuable Participant ,
May 02, 2019 May 02, 2019

Copy link to clipboard

Copied

What do you mean by "calculate checkboxes", exactly? Do you mean tick or un-tick a check-box based on the value of other check-box fields?

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 ,
May 02, 2019 May 02, 2019

Copy link to clipboard

Copied

I mean that I want the checkboxes to mathematically tally i.e. CheckBox1 value $95 + CheckBox2 value $200 = $295.

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
Most Valuable Participant ,
May 02, 2019 May 02, 2019

Copy link to clipboard

Copied

Apply the value (without the dollar symbol!) as the export value of each field and you'll be able to use the built-in Sum function under the Calculate tab to do it, without using any scripts.

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 ,
May 02, 2019 May 02, 2019

Copy link to clipboard

Copied

Here's a sample.

checkbox sample.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
Most Valuable Participant ,
May 02, 2019 May 02, 2019

Copy link to clipboard

Copied

How is this any different from what you posted before?

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 ,
May 02, 2019 May 02, 2019

Copy link to clipboard

Copied

The only difference is that I wanted you see a visual of what I was trying to create.

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
Most Valuable Participant ,
May 03, 2019 May 03, 2019

Copy link to clipboard

Copied

It's really not needed. It's just a screenshot of the code in the editor window...

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
Adobe Community Professional ,
May 05, 2019 May 05, 2019

Copy link to clipboard

Copied

LATEST

You should use checkboxes export value and the field naming convention, so things will be easier and most of calculations can be made without using JavaScript.

You can download a free sample PDF here: www.abracadabrapdf.net/parking/AcroUsers/calcul-addition-checkbox.pdf

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