Script help for a newbie?

New Here ,
Feb 12, 2020 Feb 12, 2020

Copy link to clipboard

Copied

Hello all,

 

I currently have a dropdown menu with the following options: FHA, USDA, VA, Uninsured, FNMA, Conventional Insured. What I need is a script that based on the selection from the dropdown, it will take information from another field in the form (UPB) and multiply it by a specific number (the numbers are different based on the dropdown selections). Is there a way to create a script to achieve this? 

 

I only know what I've learned from poking around in acrobat myself--any help would be greatly appreciated! 

 

 

TOPICS
Acrobat SDK and JavaScript, Edit and convert PDFs, How to, PDF forms

Views

33

Likes

translate

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
Most Valuable Participant ,
Feb 12, 2020 Feb 12, 2020

Copy link to clipboard

Copied

You can use something like this as the custom calculation script of the target field (change the name of the drop-down in line #1 and the values as needed, of course):

 

var s = this.getField("Dropdown1").valueAsString;
var v = Number(this.getField("UPB").valueAsString);
if (s=="FHA") event.value = 5 * v;
else if (s=="USDA") event.value = 10 * v;
// etc.
else event.value = "";

Likes

translate

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 ,
Feb 14, 2020 Feb 14, 2020

Copy link to clipboard

Copied

 

This worked perfectly, try67! Thank you so much! ~

Likes

translate

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