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

Create a java script that will calculate based on a true value in a checkbox

New Here ,
Dec 08, 2017 Dec 08, 2017

Copy link to clipboard

Copied

I have a form where my end user checks boxes next to a list of items wherby selecting each item they would like to include as extras in their new home. Each Item has a different price and some may have more than 1 quantity. At last there is an Amount column. At the bottom, the individual amounts are calculated as a Total of Extras to add to the Homebuyers Purchase. It is currently set up in an excel spreadsheet and is formulated to calculate the amount (Price X Quanity =Amount) based on the true value of the checkbox. And then of course to add all of the amounts to return a Total.

Example:

Item               Price                  Quantity                  Checkbox                          Amount

Item               Price                  Quantity                  Checkbox                          Amount

Item               Price                  Quantity                  Checkbox                          Amount

                                                                                                                            Total

We would like to put all of these forms (Different forms for each individual Builder's model homes with unique items/prices/square footage) into PDF documents so that our builders can just go to the website and interact with the forms.

I am new to all of this so I would be very greatful if someone could please offer me some assistance in how to program the Java Script each field.

Thanks in Advance!

TOPICS
Acrobat SDK and JavaScript , Windows

Views

309

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 ,
Dec 08, 2017 Dec 08, 2017

Copy link to clipboard

Copied

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 ,
Dec 08, 2017 Dec 08, 2017

Copy link to clipboard

Copied

Thank You!

So, after reading the instructions...

I went to the Java Script Editor for the Amount1 Field and entered the following script:

Var Amount1 = this.getField ("Price1").value;

if ( Check Box2.rawValue==true )

Amount1.value = Price1;

I got:

SyntaxError:missing ) after condition 2: at line 3

I am pretty green at this Java Scripting. Please tell me what this means and

what I should correct to get it to work properly.

Thanks!

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 ,
Dec 09, 2017 Dec 09, 2017

Copy link to clipboard

Copied

LATEST

So is this a LiveCycle form? Are you editing it in LiveCycle Designer? or is this an Acrobat form?  and you are editing it in Acrobat?

And what kind of script did you enter? Calculation Script, format script, etc.?

The script you've provided mixes different form technologies and does not have the syntax error that is shown. Is there more to the script?

Have you considered hiring a professional to fix up your form?  You would save a lot of time and money?

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

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