How to get default at 0.00

New Here ,
Sep 02, 2022 Sep 02, 2022

Copy link to clipboard

Copied

I have the following that works great, but I only want the unitprice to show till a minimum of 10 units are ordered:

var v = Number(this.getField("PlatesOrdered").valueAsString);
if (v>=10){event.value = "131.99";
if (v>19){event.value = "128.9";
if (v>49){event.value = "124.99";
if (v>99){event.value = "122.21";
if (v>249){event.value = "118.70";
if (v>449){event.value = "116.19";
if (v>999){event.value = "113.79";
}}}}}}}

TOPICS
How to , PDF forms

Views

50

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
Community Expert ,
Sep 02, 2022 Sep 02, 2022

Copy link to clipboard

Copied

Try the forum for Adobe Acrobat.

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 ,
Sep 02, 2022 Sep 02, 2022

Copy link to clipboard

Copied

I did not find anything in the forum. I think it involves an "else", but I tried it, got the same result

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
Community Expert ,
Sep 02, 2022 Sep 02, 2022

Copy link to clipboard

Copied

As first line use:

event.value = "0.00";

 

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 ,
Sep 03, 2022 Sep 03, 2022

Copy link to clipboard

Copied

Here is the script I am running. I want is the values are 0.00 till I reach a total of 10 items purchased. I tried adding an if statement of if (v <10{ event.value = "0.00; on the second line, but that does not work

 

var v = Number(this.getField("PlatesOrdered").valueAsString);

if (v=>10){event.value = "131.99";
if (v>19){event.value = "128.90";
if (v>49){event.value = "124.99";
if (v>99){event.value = "122.21";
if (v>249){event.value = "118.70";
if (v>449){event.value = "116.19";
if (v>999){event.value = "113.79";}}}}}}}

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
Community Expert ,
Sep 03, 2022 Sep 03, 2022

Copy link to clipboard

Copied

As first line use:

event.value = "0.00";

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
Community Expert ,
Sep 04, 2022 Sep 04, 2022

Copy link to clipboard

Copied

This line is incorrect:

if (v=>10){event.value = "131.99";

It should be:

if (v>=10){event.value = "131.99";

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
Community Expert ,
Sep 04, 2022 Sep 04, 2022

Copy link to clipboard

Copied

LATEST

Also, you don't need all of those curly brackets.

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