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

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

107

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

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

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

108

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
Dec 08, 2017 0
Adobe Community Professional ,
Dec 08, 2017

Copy link to clipboard

Copied

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
Reply
Loading...
Dec 08, 2017 0
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!

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
Reply
Loading...
Dec 08, 2017 0
Adobe Community Professional ,
Dec 09, 2017

Copy link to clipboard

Copied

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?

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
Reply
Loading...
Dec 09, 2017 0