• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

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

Views

216

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 ,
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 = "";

Votes

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

LATEST

 

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

Votes

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