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

Help with java script for adobe a pdf form

New Here ,
Dec 06, 2019 Dec 06, 2019

Copy link to clipboard

Copied

Good Morning.  I am trying to figure out how to get a field to automatically populate a value using java script with an if then statement.  I want it to look at the value of two other fields and return which is the highest, below is the code i have been using. Any and all help is appreciated.  I have tried it on both the calculations tab with custom java script and on the Actions tab but am unsure which trigger to use and which is correct.

 

if(this.getField("EXV").value > this.getField("CFMV").value){

event.value = EXV

} else {

Event.value = CFMV

}

 

 

[Moderator moved the thread to the correct forum]

TOPICS
Acrobat SDK and JavaScript

Views

87

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
community guidelines
Community Expert ,
Dec 06, 2019 Dec 06, 2019

Copy link to clipboard

Copied

Try this:

var EXV = Number(this.getField("EXV").valueAsString);
var CFMV = Number(this.getField("CFMV").valueAsString);
if(EXV > CFMV) {
  event.value = EXV;
} else {
  event.value = CFMV;
}

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
community guidelines
LEGEND ,
Dec 06, 2019 Dec 06, 2019

Copy link to clipboard

Copied

LATEST

JavaScript is case sensative. You cannot have the value of an event wrtitten as "Event.value" and "event.value".

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
community guidelines