I need help with a code that will auto populate

New Here ,
Mar 20, 2019

Copy link to clipboard

Copied

from another field if another field is zero. This would go after the code: event.value=Number(this.getField("EE Net Prem").valueAsString)/ Number(this.getField("multiplier").valueAsString);

Most Valuable Participant
Correct answer by try67 | Most Valuable Participant

Not sure what you're asking, but if you use this code you have to make sure that the value of "multiplier" is not zero first.

TOPICS
Acrobat SDK and JavaScript, Macintosh, Windows

Views

98

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

I need help with a code that will auto populate

New Here ,
Mar 20, 2019

Copy link to clipboard

Copied

from another field if another field is zero. This would go after the code: event.value=Number(this.getField("EE Net Prem").valueAsString)/ Number(this.getField("multiplier").valueAsString);

Most Valuable Participant
Correct answer by try67 | Most Valuable Participant

Not sure what you're asking, but if you use this code you have to make sure that the value of "multiplier" is not zero first.

TOPICS
Acrobat SDK and JavaScript, Macintosh, Windows

Views

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
Mar 20, 2019 0
Most Valuable Participant ,
Mar 20, 2019

Copy link to clipboard

Copied

Not sure what you're asking, but if you use this code you have to make sure that the value of "multiplier" is not zero first.

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...
Mar 20, 2019 0
New Here ,
Mar 20, 2019

Copy link to clipboard

Copied

the multiplier is the commission base- so usually I use the net premium/multiplier (typically .85) to populate into the gross premium field. Not all groups have commission. I keep getting an error for "the value entered does not match the format of the field (EE Gross Prem)" when the multiplier is zero.

Is there another way I should write it so it will accept a number or zero?

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...
Mar 20, 2019 0
try67 LATEST
Most Valuable Participant ,
Mar 20, 2019

Copy link to clipboard

Copied

Use this code:

var v1 = Number(this.getField("EE Net Prem").valueAsString);

var v2 = Number(this.getField("multiplier").valueAsString);

if (v2==0) event.value = "";

else event.value = v1/v2;

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...
Mar 20, 2019 0