Skip to main content
Participant
Dec 6, 2019 2:20 PM UTC
Question

Help with java script for adobe a pdf form

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]

This topic is closed to new replies. Start a new post to keep the conversation going.

2 replies

Inspiring
Dec 6, 2019 2:49 PM UTC

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

Translate
Bernd Alheit
Community Expert
Community Expert
Dec 6, 2019 2:42 PM UTC

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;
}
Translate