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

Javascript Help

New Here ,
Nov 27, 2019 Nov 27, 2019

Copy link to clipboard

Copied

Hi Guys,

 

Hope you can help. I have a drop down box (Dropdown21) which has multiple employment options in there. Employed, Self Employed, Retired and House Person. I am using a button to run a Javascript, the idea being that if you select Houseperson in the dropdown box it will populate another field (C2_House_Person) with the value 15000. If you select anything else then it will be 0. So far I have the following:-

 

var v1 = (this.getField("Dropdown21").valueAsString);
if (this.getField("Dropdown21").value=="a House Person") event.value = "15000";
this.getField("C2_House_Person").value = v1

 

 

TOPICS
Acrobat SDK and JavaScript

Views

217

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

correct answers 1 Correct answer

Community Expert , Nov 27, 2019 Nov 27, 2019

Move this code to be the custom calculation script of "C2_House_Person" and change it to this:

 

var v1 = this.getField("Dropdown21").valueAsString;
if (v1=="a House Person") event.value = "15000";
else event.value = "0";

 

Make sure to set the properties of the drop-down to commit the selected value immediately (under Properties - Options), or it will only work when you exit that field.

 

Votes

Translate

Translate
Community Expert ,
Nov 27, 2019 Nov 27, 2019

Copy link to clipboard

Copied

LATEST

Move this code to be the custom calculation script of "C2_House_Person" and change it to this:

 

var v1 = this.getField("Dropdown21").valueAsString;
if (v1=="a House Person") event.value = "15000";
else event.value = "0";

 

Make sure to set the properties of the drop-down to commit the selected value immediately (under Properties - Options), or it will only work when you exit that field.

 

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