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

56

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

correct answers 1 Correct Answer

Most Valuable Participant , 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.  

Likes

translate

Translate

Translate
Most Valuable Participant ,
Nov 27, 2019 Nov 27, 2019

Copy link to clipboard

Copied

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.

 

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