Stop Auto Calculation when other fields change

New Here ,
Dec 12, 2018

Copy link to clipboard

Copied

Hi there,

I am facing a problem regarding a percentage calculation in my form.

As of now my code to receive a proper display of the correct percentage decimal I am using this code:

if(event.target.name=="Tax")

{

event.value=event.value/100;

}

This works fine so far. However, when I change any other value of other fields this specific field starts to calculate again the value by 100.

Example:

Tax: 5%

-> Changing field of unit price

Tax: 0.05% (it calculates the value again by 100).

Anybody an idea how to solve this problem?

Thank you in advance!

Ketch

TOPICS
Acrobat SDK and JavaScript

Views

102

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

Stop Auto Calculation when other fields change

New Here ,
Dec 12, 2018

Copy link to clipboard

Copied

Hi there,

I am facing a problem regarding a percentage calculation in my form.

As of now my code to receive a proper display of the correct percentage decimal I am using this code:

if(event.target.name=="Tax")

{

event.value=event.value/100;

}

This works fine so far. However, when I change any other value of other fields this specific field starts to calculate again the value by 100.

Example:

Tax: 5%

-> Changing field of unit price

Tax: 0.05% (it calculates the value again by 100).

Anybody an idea how to solve this problem?

Thank you in advance!

Ketch

TOPICS
Acrobat SDK and JavaScript

Views

103

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 12, 2018 0
Adobe Community Professional ,
Dec 12, 2018

Copy link to clipboard

Copied

Don't use that code. Never use a field value in its own calculation.

If you need to divide this number by 100 for use in another calculation, then do the division there.

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 12, 2018 0
Most Valuable Participant ,
Dec 12, 2018

Copy link to clipboard

Copied

Just don't use the Percentage format, then... You can add the "%" symbol using a custom Format script, like this:

if (event.value) event.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
Reply
Loading...
Dec 12, 2018 0
Community Beginner ,
Dec 12, 2018

Copy link to clipboard

Copied

The calculation format should

be used for you to use the code.

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 12, 2018 0